Intro to Regression


Regression, in essences, is a method for finding values of unknown constants so an equation can fit the given data points. Regression is especially useful on the algebra section as we can skip the tedious algebra work and obtain the value for the unknown variable that we need. Mastering regression should always be a top priority



Creating a regression


Before we look at regressions we should understand how variables work.



desmos has two kinds of variables:

Defined variables have specific values assigned to them like a = 2 while infinite variables will have an infinite list of values assigned for them. This is why $$y=2x+5$$ will create a linear line, yet $$y=2a+5$$ will be a vertical line as desmos will view the function as $$y=2(2)+5$$ rather than an infinite set of x values.

Regression requires defined variables instead of infinite variables as it needs specific data points.


Lets look at this example:

  • $$3\left(x-3\right)-11=4\left(x-3\right)+6$$

  • What value of x is the solution to the given equation?

    While we can use basic algebra to solve for x to find x-3, instead, we can replace replacing x with x1, turning it into a defined variable, and use the surrounding constants to find x. To differentiate between an equation and regression we use the ~ sign.

    Note: we can create x1 by inputting a 1 right after x. Desmos will automatically place the subscript.



    Points and regression

    Remember for x amount of constants you need to find, you should have x amount of data points for that function.


    The previous example was a bit different in the sense that the surrounding constants acted at 1 data point for x1


    Let's try this example:

    The graph of the equation $$ax+ky=6$$ is a line in the xy-plane, where a and k are constants. If the line contains the points (-2,-6) and (0,-3). what is the value of k?


    Although we are only looking for one constant since we have two unknowns we still need two data points



    Second Example

    The cubic function $$y=(ax+3)(5x^2-bx+4)$$ passes through the points (1,21) and (2,132). What is the value of a and b

    We have two unknown variables and 2 data points, so we can use the table function


    Values from regression

    Remember regression will take the closest absolute value number.


    If we look at this equation:




    Using List for regression

    We can use lists instead of tables to store our numbers. We will call these numbers elements from now on.


    The function y=mx+b is passes through the points (0,2) and (2,6). What are m and b equal to?

    We can utilize the table, but let's try something different and create a list instead, storing the y's and x's as elements


    • We can put this into y=mx+b form now to get this:

    • However, to make it clear about what is happening we can replace the defined variables with the lists.
    • The first element on the left is assigned to the first element on the right and everything else with it, looking like this 1=(0)m+b. The same goes with the second element: 3=(1)m+b

    Undefined regions of regression

    If you are using random values of x1 to make sure your answer is correct to not include values of x1 that will cause an undefined region error


    • Any number except -1 within the list will provide an answer for "a"
    • This is because when x1=1 the denominator is 0 causing this error