# 213 - A1 - Linear Equations

## 703 days ago by Professor213

Basic Linear Equations

John Travis

Mississippi College

Roughly, a linear equation is an expression where all of the variable terms are raised to the first power and not multiplied by other variable terms.  You are familiar with the standard equation for a line $y = mx + b$ and that is indeed a linear equation.  However, linear equations can contain many variables--and not just the x and y from your long forgotten past.  To keep things straight when you may have a number of variables, we often will denote the variables in a sequence format $x_1, x_2, ... , x_n$ which yields a more general form for a linear equation:

$a_1 x_1 + a_2 x_2 + a_3 x_3 + ... + a_n x_n = b$

where the terms $a_j$ are constant parameters known as the coefficients.  Of course, if you have more than one equation to deal with at a time, you will need some way to denote each one.  If each equation uses the same variables, the only thing that has to be changed is the collection of coefficients.  So, for each coefficient we add another subscript $a_{i,j}$ where the index "i" denotes the equation number and the second index "j" denotes which variable to associate with the value.  So, a more general way of referring to a linear equation is

$a_{i,1} x_1 + a_{i,2} x_2 + a_{i,3} x_3 + ... a_{i,n} x_n = b_i$

2D

In two dimensions, since there are so few terms to deal with, we often resort to using the old fashioned variables $x$ and $y$ versus $x_1$ and $x_2$.   To make things easier in 2D, we also may write the coefficients without subscripts in the form  ax + by = c.

Regardless of the form of the equation, you can graph a line by plotting points or using point/slope ideas like you have done many times in your life.  In the box below, play around with the coeffiicients to see how each affects the graph of the resulting line.

%hide %auto var('x,y') @interact def _(a1=slider(-5,5,1/4,0,label='$a_1$'),a2=slider(-5,5,1/4,1,label='$a_2$'),b=slider(-12,12,1,0)): html('$(%s)$'%str(a1)+'$x + (%s)$'%a2+'$y = %s$'%b) implicit_plot(a1*x+a2*y==b,(x,-5,5),(y,-5,5),aspect_ratio=True).show()

$a_1$
$a_2$

## Click to the left again to hide and once more to show the dynamic interactive window

Questions:

• How does the sign and value of $a_1$ and $a_2$ affect the graph of the line?
• How does changing the value of b affect the graph of the line?

You can graph two lines at the same time but will need to supply two sets of coefficients--one set for each line.  Below, go ahead and type in the equations for each line and be certain to write the equations using correct mathematical syntax explicitly using "*" for every necessary multiplication.  Also, use "= =" instead of a single equals.

%hide %auto var('x,y') @interact def _(eq1=(3*x+2*y==6),eq2=(3*x-2*y==6),auto_update=True): print 'If you change the equations above, press Enter to redo the graphs' P1=implicit_plot(eq1,(x,-5,5),(y,-5,5),aspect_ratio=True) P2=implicit_plot(eq2,(x,-5,5),(y,-5,5),aspect_ratio=True) soln = solve([eq1,eq2],x,y,solution_dict=True,ring=RR) if soln==[]: print html("\nThese lines do not intersect.") show(P1+P2) else: for value in soln: x0 = value[x] y0 = value[y] print html('\nThe lines intersect at ('+str(x0)+','+str(y0)+')') soln_pt = point2d((x0,y0),size=40,rgbcolor='red') show(P1+P2+soln_pt)

 eq1 eq2 auto_update

## Click to the left again to hide and once more to show the dynamic interactive window

3D

You can also see the graphs of linear equations with three variables.  In this case, we sometimes also just use the variables x, y and z and write the equations ax + by + cz = d instead of $a_1 x_1 + a_2 x_2 + a_3 x_3 = b$.  Below, experiment with entering various linear equations with the three variables x, y and z using the same format as you did with the graphs above.  Notice what the resulting graphs of each equation look like and when and if they intersect.

%hide %auto var('x,y,z') @interact def _(eq1=(3*x+2*y-5*z==6),eq2=(3*x-2*y==6),eq3=(2*x+3*z==9),auto_update=True): print 'If you change the equations above, press Enter to redo the graphs' P1=implicit_plot3d(eq1,(x,-5,5),(y,-5,5),(z,-5,5),aspect_ratio=True,color='red') P2=implicit_plot3d(eq2,(x,-5,5),(y,-5,5),(z,-5,5),aspect_ratio=True,color='green') P3=implicit_plot3d(eq3,(x,-5,5),(y,-5,5),(z,-5,5),aspect_ratio=True,color='blue') # soln = solve([eq1,eq2,eq3],x,y,z,ring=RR) P = P1+P2+P3 soln = solve([eq1,eq2,eq3],x,y,z,solution_dict=True,ring=RR) if soln==[]: print html("\nThese planes do not intersect.") else: for value in soln: x0 = value[x] y0 = value[y] z0 = value[z] print html('\nThe planes intersect at ('+str(x0)+','+str(y0)+','+str(z0)+')') soln_pt = point3d((x0,y0,z0),size=20,rgbcolor='yellow') P += soln_pt show(P)

 eq1 eq2 eq3 auto_update

## Click to the left again to hide and once more to show the dynamic interactive window

# Students should not know how to do this! :) var('x,y,a,b') eq1 = 2*x+5*y == a eq2 = 5*x+13*y == b solns = solve([eq1,eq2],x,y,ring=RR) for soln in solns: show(soln)