In ya=cb it seems I can't turn the left side into y in one operation. (Might have something to do with the fact that y only defines the granularity or scale of a).
Remember: in equations you can generally do the same thing to both sides — add, subtract, multiply, divide, raise to a power, take a logarithm, etc.: https://math.stackexchange.com/a/805939
Remember: in solving equations like 3a+5=a−3, first put each variable and constant to only one side: 3a−a=−3−5. Then simplify.
Remember:cross-multiplying fractions is essentially just multiplying both sides by the same fraction. Cross-multiplying is a shortcut:
ba=dcad=cb
A longer, non-shortcut version:
ba=dcba∗dd=dc∗bbbdad∗bd=bdcb∗bdad=db
We can multiply one side with dd and the other side with bb, because both equal 1, so we're still multiplying both sides by the same number. Also, you can always divide the numerator and the denominator of a fraction by the same value without the fraction's value changing, which we're doing here.
Remember:The best way is to multiply both sides by the product of the denominators...
ba=dcba∗bd=dc∗bdad=cb
...since (unlike cross-multiplying) it works also when one or both of the sides consist of multiple fractions:
x+ba=dcbd(1x+ba)=bd(dc)xbd+ad=cb
ba=dc−yxbdy(ba)=bdy(dc−yx)ady=bcy−bdx
Remember: there are a few shortcuts for flipping numerators and denominators in an equation where both sides are a single fraction:
Invertendo: ba=dcab=cdFlip tops and bottoms
Alternando: ba=dcca=dbFlip one of the diagonals
Remember: in a set of fractions, like in the equation above, you can multiply both sides of the equation by the lowest common denominator rather than the product of the denominators.
If we multiply with the product of the denominators (90), then the numbers get quite large:
3y−53y−7=6y−230y−18(3y−7)=15y−30etc.
But if we multiply by the LCD (30), the numbers are smaller and therefore easier to work with:
3y−53y−7=6y−210y−6(3y−7)=5y−10etc.
The lowest common denominator (LCD) is the lowest common multiple of the denominators of a set of fractions. It simplifies adding, subtracting, and comparing fractions.
You can see how this works when you factor the denominators into primes. Then take only one of each number in the denominators, multiply them together, and multiply both sides by the product. Below we have two 3's, one 5 and one 2. Therefore we will ignore the other 3, and multiply both sides by 3∗5∗2 (not 3∗5∗2∗3).
The same principle works when the denominators contain variables, not numbers. This is similar to what we did here, because we're ignoring repeated factors in the denominators, i.e., we're only taking one of each factor when multiplying both sides. We ignore the other b and d.
ba−cd1=bd1
We could multiply both sides by the product of the denominators:
b2cd2(ba−cd1)=b2cd2(bd1)bcd2a−b2d=bcd
But it's better to multiply both sides by the LCD (i.e., take only one of b, c and d, and ignore the repeated factorsb and d in the denominators):
bcd(ba−cd1)=bcd(bd1)acd−b=c
43m−5−39−2m=0129m−15−36+8m=017m−51=0∗12m=3
or multiply both sides by 12 and ignore repeating factors:
Remember to multiply both sides of the equation by the LCD. Or if you want to only simplify the left side of the equation here by using ba−dc=bdad−cb, remember to actually retain the bd denominator (i.e. 6).
4x+3−5x−1=102x−1Lowest common multiple: 4∗55x+15−4x+4=4x−23x=21x=7
The rules for solving an equation are also used to rearrange a formula, a.k.a. changing the subject of the formula:
T=2πglT2=(2πgl)2T2=4π2glT2g=4π2ll=4π2gT2
u is the distance of an object from a lens. f is the focal length of the lens. v is the distance from the lens to the projected image.
u1+v1=f1vf+uf=uvuf=uv−fvuf=v(u−f)v=u−fuf
set xrange [-40:60]
set yrange [-40:60]
set xlabel 'u (distance from lens to object, cm)'
set ylabel 'v (distance from lens to image, cm)'
f = 8
v(u) = (u * f) / (u - f)
plot v(x) title 'v'
Remember: always start by isolating the variable-to-solve-for on one side of the equation. Above I made the mistake of not isolating R21 as the first step.
To find the midpoint of a line, take the average of the x points, and the average of the y points:
$data << EOD
2 -1
8 5
EOD
$dataXY << EOD
2 -1
8 -1
8 5
EOD
set label "Midpoint (5,2)" at 5,2 right offset -1,1
$dataMid << EOD
5 -1
5 2
8 2
EOD
set xtics 1
set ytics 1
set xrange [0:10]
set yrange [-2:6]
set nogrid
plot "$data" with linespoints notitle, "$dataXY" with lines dt 2 notitle, "$dataMid" with linespoints dt 2 notitle
It's a constant offset to y. It moves the whole of y up or down.
If we put x=0 we get y=c so the point (0,c) is where the line cuts the y-axis (its y intercept).
I'll try with a graph:
$data << EOD
-1 2
4 -1
EOD
set label "y-intercept" at 0,1.5 left offset 1,0.5
set xtics 1
set ytics 1
set xrange [-2:5]
set yrange [-2:5]
set nogrid
plot "$data" with linespoints notitle
The slope is:
m=4−−1−1−2=−53
How to get the y-intercept, i.e. c? Without knowing it, the function y=−53x will be drawn through the origin like this:
set xtics 1
set ytics 1
set xrange [-2:5]
set yrange [-2:5]
set nogrid
f(x) = -(3.0/5.0)*x
plot f(x) notitle
Find the y-interceptc for any known point (x,y) and slope m:
y=mx+cc=y−mx
2=−53∗−1+c2−53=cc=57
Therefore our function y=−53x+57 looks like this:
set xtics 1
set ytics 1
set xrange [-2:5]
set yrange [-2:5]
set nogrid
set label "y-intercept (0, 7/5)" at 0,(7.0/5.0) left offset 1,1
set label "x-intercept (7/3, 0)" at (7.0/3.0),0 left offset 1,1
f(x) = -(3.0/5.0)*x + (7.0/5.0)
plot f(x) notitle
How do we find the x-intercept? Analogously, it must be the value of x when y=0.
y=mx+c0=mx+cx=my−cx=−mc
x=−(57÷−53)=−(−1535)=37
2.B.3 special cases
$data << EOD
3 -5
3 5
EOD
set xtics 1
set ytics 1
set xrange [-2:5]
set yrange [-5:5]
set nogrid
set nozeroaxis
f(x) = 2
g(x) = -3
plot f(x), g(x), "$data" with lines title "h(x)"
mx+c=20x+2=2f(x)=2Set the slope to 0mx+c=−30x+−3=−3g(x)=−3Set the slope to 0
Defining a function for the vertical line in terms of x seems impossible.
x=3y=mx+cx=my−cm=3−313=undefinedy−∞…
How much do you need to know to distinguish a particular straight line from all the other possible straight lines?
Based on the straight line equation y=mx+c:
The slope
At least one (x,y) coordinate on the line
This can be the y-intercept, but doesn't have to be, since we can compute c if given the slope and any point on the line
Or:
Any two points on the line. m=x2−x1y2−y1 gives you the slope, after which you can calculate c as well: c=y1−mx1
The line equation
Remember: there are many forms of the equation for a straight line. The main ones are:
Slope-intercept form (when you know the slope and y-intercept): y=mx+c
Point-slope form (when you know a point and the slope): y−y1=m(x−x1)
Standard form: Ax+By=C
It's probably best to remember mainly the slope-intercept form and the slope equation.
You can rearrange the slope equationm=x2−x1y2−y1=x−x1y−y1 to all of the different forms, so it's especially important to remember it.
From the slope equation to the point-slope form:
m=x−x1y−y1m(x−x1)=y−y1y=m(x−x1)+y1
This looks almost like the slope-intercept form, but not quite, since we have m(x−x1) instead of mx.
With the point-slope form we know a point (x1,y1) and the slope:
y=mx−mx1+y1y=43(x)−43(1)+45=43x+21
We can set x1=0 to get the slope-intercept form. (I'll rename y1 to y0 here as well.)
y=m(x−0)+y0Note the identity property: x−0=xy=m(x)+y0This is the slope-intercept form
With the slope-intercept form we know the slope and the y-intercept:
y=43x+21
$data1 << EOD
1 1.25
4 1.25
4 3.5
EOD
$data2 << EOD
1 1.25
3 1.25
3 2.75
EOD
set xtics 1
set ytics 1
set xrange [-1:6]
set yrange [-0.5:5]
set label "(x_1, y_1)" at 1,1.25 right offset -1,0.5
set label "(x, y)" at 3,2.75 right offset -1,0.5
set label "(x_2, y_2)" at 4,3.5 right offset -1,0.5
set label "m = 0.75\nc = 0.5" at 1.2,3.7
set style fill solid 0.1
f(x) = (3.0/4.0)*x + 0.5
plot f(x) notitle, "$data1" with filledcurves lt 3 notitle, "$data2" with filledcurves lt 6 notitle, "$data1" with points pt 7 lt 3 notitle, "$data2" with points pt 7 lt 6 notitle
Remember that usually the x and y without a subscript mean any value in the sequence, and xn and yn mean a specific value.
In the slope-intercept form, you plug in x1 and y1, since they're known. You leave x and y unknown, since they represent any possible point on the line. (There are infinitely many points on the line, infinitesimally far apart.) For example:
y−5=2(x−3)y=2x−1
In the graph below, you can think that moving (x,y) anywhere along the line still satisfies m=x2−x1y2−y1=x−x1y−y1, or, rearranged, m=y2−y1y−y1=x2−x1x−x1.
$data1 << EOD
1 1.25
4 1.25
4 3.5
EOD
$data2 << EOD
1 1.25
3 1.25
3 2.75
EOD
set xtics 1
set ytics 1
set xrange [-1:6]
set yrange [-0.5:5]
set label "(x_1, y_1)" at 1,1.25 right offset -1,0.5
set label "(x, y)" at 3,2.75 right offset -1,0.5
set label "(x_2, y_2)" at 4,3.5 right offset -1,0.5
set label "m = 0.75\nc = 0.5" at 1.2,3.7
set style fill solid 0.1
f(x) = (3.0/4.0)*x + 0.5
plot f(x) notitle, "$data1" with filledcurves lt 3 notitle, "$data2" with filledcurves lt 6 notitle, "$data1" with points pt 7 lt 3 notitle, "$data2" with points pt 7 lt 6 notitle
set terminal svg size 500,500 enhanced font 'Verdana,10'
$dataTri << EOD
0 0
3 0
3 2
EOD
$dataA << EOD
3 0
5 0
5 2
3 2
EOD
$dataB << EOD
0 0
0 -3
3 -3
3 0
EOD
$dataC << EOD
0 0
3 2
1 5
-2 3
EOD
set noxtics
set noytics
set xrange [-3:6]
set yrange [-3.5:5.5]
set nozeroaxis
set style fill solid 0.1
set label "A" at 2.9,1 right
set label "B" at 1.6,0.1 center
set label "C" at 1.6,0.9 center
plot "$dataTri" with filledcurves notitle, "$dataA" with filledcurves notitle, "$dataB" with filledcurves notitle, "$dataC" with filledcurves notitle
We can use the Pythagorean theorem to get the distance between two points:
Remember: to find a line perpendicular (i.e. at 90 degrees) to another line, the two lines' slopes multiplied together must equal −1.
m1m2=−1
Let's see if I can rearrange this, so that I can find a perpendicular line easily:
(xa−xa1ya−ya1)(xb−xb1yb−yb1)=−1for the slopes of any perpendicular lines A and B
Since I only need any possible perpendicular line, I can make both lines go through (0,0). Therefore, some assumptions:
xa1=0ya1=0xb1=0yb1=0
set xtics 1
set ytics 1
set xrange [-3:6]
set yrange [-2:4]
$data << EOD
0 0
2 1
-1 2
EOD
set label "(x_{a1}, y_{a1}) and (x_{b1}, y_{b1})" at 0,0 offset 1.5,-0.5
set label "(x_a, y_a)" at 2,1 offset 1.5,-0.3
set label "(x_b, y_b)" at -1,2 offset 1,0
A(x) = 0.5 * x
B(x) = -2 * x
plot A(x), B(x), "$data" with points lt 6 pt 7 notitle
Therefore:
(xaya)(xbyb)=−1
Rearranging:
xbyb=−1÷xaya=−1(yaxa)
Therefore, to find a perpendicular slope mb for slope ma=xaya:
mb=xbyb=−yaxa
Remember:negative reciprocal — take the reciprocal (i.e. flip the numerator and denominator) of slope ma, and negate.
Also remember: reciprocal (a.k.a. multiplicative inverse): what number multiplied by x gives 1?
Answer: x1∗x=1. For example, the reciprocal of 3 is 31 (just flip the fraction).
What follows here is a long series of me just playing with the line equations.
If ma=xaya=21, then mb=−yaxa=−12.
set xtics 1
set ytics 1
set xrange [-2:7]
set yrange [-2:4]
A(x) = 0.5 * x
B(x) = -2 * x
plot A(x), B(x)
I can move line B along line A by changing the y-intercept of line B:
yb=−2xb+10
set xtics 1
set ytics 1
set xrange [-1:8]
set yrange [-1:5]
A(x) = 0.5 * x
B(x) = -2 * x + 10
plot A(x), B(x)
Assuming A travels through (0,0), how can I determine the correct y-intercept for B if I want the lines to intersect at a specific point of A?
If line A is horizontal, then the intersection point is at the x-intercept:
xb=−mbcbmbxb=−cbcb=−mbxb=−(yaxa)xb
So if I want the lines to intersect at xb=5:
cb=−(−12)(5)=10
But it gets more difficult when line A is not horizontal.
Maybe I can just rearrange the slope-intercept equation:
yb=mbxb+cbxb=xayb=ya(xa,ya) and (xb,yb) are the same point (A and B intersect)ya=mbxa+cbcb=ya−mbxacb=2−(−2)(4)=10
Remember that mb=xbyb=−yaxa:
cb=ya−mbxa=ya−(−yaxa)xa=ya+yaxa2
Therefore, to find the y-intercept of B, when you only know a point (xa,ya), and A travels through (0,0):
cb=ya+yaxa2cb=2+216=10
You can alternatively write this as dividing by the slope of A:
ma=xayacb=ya+xa÷xayacb=ya+xa÷ma
I wonder: when we say ma=xaya and the perpendicular slope mb=−yaxa, rather than me just saying "flip the numerator and denominator and negate the value", is there some mathematical operation, e.g. multiplying by some value v, that I can use to achieve this flipping and negation?
OK, so mb=(−y2x2)(xy)=(xy)÷(−x2y2)=ma÷−(ma2)=−ma1=−ma−1.
To find the perpendicular slope mb for ma, divide ma by itself squared and negated.
mb=ma÷−(ma2)
This might be interesting in the future, but doesn't help me now. For now it's better to remember that mb is simply the negative reciprocal of ma, i.e. mb=−ma−1.
Edit (2022-08-07): remember — when you have an equation like tanα=xy and you want to flip y and x (i.e. take the reciprocal a.k.a. multiplicative inverse), flip the fractions on both sides of the equation: tanα1=yx.
Edit (2022-10-02): remember — when you want to take the reciprocal of
a number, simply divide 1 by your number. For example: if a=yx,
then its reciprocal b is b=a1=1/yx=1∗xy=xy.
What if A does not travel through (0,0)? How do I find cb then? Just looking at the graph, maybe I can add the y-intercept of A (i.e. ca) to the equation, since it moves both A and B upwards on the Y axis:
cb=ya+yaxa2+ca
For the graph below we want A and B to intersect at xa=3:
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = -2 * x + 8.071
plot A(x), B(x)
This is close, but not correct, since the lines should intersect at xa=3. A does not travel through (0,0). I need to have both ca and cb in the same equation somehow, which the slope-intercept form yb=mbxa+cb didn't allow.
Therefore, to find the y-intercept of line B that is perpendicular to line A and intersects at xa:
cb=maxa+ca+maxa
Note that this is almost the line equation y=mx+c, but with the additional maxa.
Now I can find the correct y-intercept of B that intersects at xa=3:
cb=213+2+3÷21=23+8=219=9.5
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = -2 * x + 9.5
plot A(x), B(x)
Update: see here for an even better solution with trigonometry.
2.B.6
(a)
y−y1=m(x−x1)Start with point-slope formy−4=−21(x−1)y−4=−21x+21y=−21x+29Rearranged into slope-intercept form2y+x=9Rearranged into standard form
(b)
3y+2x=13y=−2x+1y=3−2x+1=−32x+31=−32x+31ma=−32mb=23Negative reciprocal of may−4=23(x−1)y=23x+25or2y−3x=5
(c)
4y+x=04y=−xy=−41xma=−41mb=14y−4=4(x−1)y=4x
Above we found the midpoint of a line. Here we find a point on a line at a specific ratio:
(x1+p+qp(x2−x1),y1+p+qp(y2−y1))
$p << EOD
1 3
3 9
EOD
$q << EOD
3 9
6 18
EOD
$dataXY << EOD
1 3
6 3
6 18
EOD
set label "Point at ratio p:q" at 3,9 right offset -1.5,0.5
set label "p" at 2,6 right offset -1.5,0
set label "q" at 4.5,13.5 right offset -1.5,0
$dataPoint << EOD
3 3
3 9
6 9
EOD
set xtics 1
set ytics 1
set xrange [-1:10]
set yrange [-1:19]
set nogrid
plot "$p" with linespoints title "p", "$q" with linespoints title "q", "$dataXY" with lines dt 2 notitle, "$dataPoint" with linespoints dt 2 notitle
Self test 4, (7)
Initially I thought I could just plug in the ratio directly as a fraction r=qp. In other words, I thought "ratio" means the same as "percentage" or "fraction", but it doesn't.
$data << EOD
1 3
6 18
EOD
$dataXY << EOD
1 3
6 3
6 18
EOD
set label "Point at fraction 2/3" at 4.333,13 right offset -1,0.5
$dataPoint << EOD
4.333 3
4.333 13
6 13
EOD
set xtics 1
set ytics 1
set xrange [-1:10]
set yrange [-1:19]
set nogrid
plot "$data" with linespoints notitle, "$dataXY" with lines dt 2 notitle, "$dataPoint" with linespoints dt 2 notitle
By ratio2:3 they don't mean the fraction 32. Rather they mean that p has length 2 and q has length 3, so the total length is 5, and the fraction is p+qp=2+32.
$p << EOD
1 3
3 9
EOD
$q << EOD
3 9
6 18
EOD
$dataXY << EOD
1 3
6 3
6 18
EOD
set label "Point at ratio 2:3\n(fraction 2/5)" at 3,9 right offset -1.5,1
set label "p = 2" at 2,6 right offset -1.5,0
set label "q = 3" at 4.5,13.5 right offset -1.5,0
set label "p:q = 2:3" at 0.5,16.5 left offset 0,0
$dataPoint << EOD
3 3
3 9
6 9
EOD
set xtics 1
set ytics 1
set xrange [-1:10]
set yrange [-1:19]
set nogrid
plot "$p" with linespoints title "p", "$q" with linespoints title "q", "$dataXY" with lines dt 2 notitle, "$dataPoint" with linespoints dt 2 notitle
Simultaneous equations
{y=21x+2y=−2x+219
What values of x and y will make both equations true? We're looking for an intersection.
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = -2 * x + 9.5
plot A(x), B(x)
Note: adding one more line C does not add any new information, since A and B already show us where they intersect, andC already intersects at the same point. We only need two from {A,B,C}.
⎩⎪⎪⎨⎪⎪⎧y=21x+2y=−2x+219y=2x+−25
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = -2 * x + 9.5
C(x) = 2 * x + -2.5
plot A(x), B(x), C(x)
On the other hand, if some of the lines intersect at different points, then not all of the equations are consistent with each other (i.e. simultaneously true):
⎩⎪⎪⎨⎪⎪⎧y=21x+2y=−2x+219y=x−1
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = -2 * x + 9.5
C(x) = x - 1
plot A(x), B(x), C(x)
Note: two parallel lines never intersect. Therefore there is no solution (x and y) that fits both of these lines' equations.
set xtics 1
set ytics 1
set xrange [-1:15]
set yrange [-1:11]
A(x) = 0.5 * x + 2
B(x) = 0.5 * x + 5
plot A(x), B(x)
Remember: two ways of solving simultaneous equations:
Substitution
{2x+3y=5x−2y=6
Rearrange one of the equations so that it gives the value of x or y:
{2x+3y=5x=2y+6
Since we're looking for values of x and y that satisfy both equations (i.e. we assume that their lines intersect), we can just substitutex or y in one equation with the whole other equation:
2x+3y=52(2y+6)+3y=54y+12+3y=5y=−1
And then substitute y in the other equation:
x−2y=6x−2(−1)=6x=4
The lines intersect at (4,−1).
Elimination
{2x+3y=5x−2y=6
Multiply one or both of the equations, such that either the x or ycoefficients (factors) are each other's additive inverses (aka negation, aka sign change):
{2x+3y=5−2x+4y=−12Multiplied both sides by −2
Then add both equations (left-hand side to left-hand side, and right-hand side to right-hand side):
7y=−7y=−1
(You could've also subtracted the equations, if their signs were the same. Remember: when you're solving simultaneous equations with elimination, you can either add or subtract the two equations.)
And then substitute y in the other equation, like in substitution above, to get x.
When eliminating, you can also multiply the equations by different values (e.g. multiply the upper equation by 2 and lower equation by 3 to get rid of y) — whichever values that allow you to eliminate either x or y.
Remember: in real-life situations there are likely more than 2 variables. If there are as many equations as there are variables (e.g. 4 equations with 4 variables), then you can usually solve them with multiple rounds of elimination, until just one variable is left.
3x−2y=21x=321+2y=7+32yx from equation 12(7+32y)+5y=−5Substitute x in equation 214+34y+5y=−5319y=−19y=−19/319=19−1∗19∗3=−3Found y for equation 2x=7+32(−3)=5Found x for equation 12(5)+5(−3)=−5Test x in equation 2
320x+10=0x=−10/320=−23Solved x for both equations
6(−23)+y+8=0y=9−8=1Solved y in equation 2
−23/3−21+1=0Test y in equation 1−63−21+1=0
Remember: when solving simultaneous equations (or any equations for that matter), aim to get rid of the fractions first. The above would've been easier if you first multiplied both equations by larger values (rather than just multiplying the top equation by 2) to get rid of the fractions.
b/2 gives you the number for the perfect square's summand: 6/2=3
(b/2)2 gives you the number to subtract: (6/2)2=9
Remember: learn to think of completing the square whenever you see x2+bx. You should immediately see that x2+bx=(x+2b)2−(2b)2. You should also learn to always see the visualization of completing the square in your mind when you think of the algebra.
Perfect square
Remember that a "perfect square" has a couple of different definitions:
A square number, i.e. n2, such that n is an integer: n2=1,4,9,16,25, etc.
Apparently a and c are always square numbers (according to the first definition above) in perfect square trinomials (but not enough — for example, 4x2+5x+16 is not a perfect square trinomial).
For example, this satisfies the first definition:
x2=Perfectsquare25x=Integerroot±5
Can I manipulate the above into a perfect square trinomial?
x2=25x=±5x±5=0(x±5)2=02x2±10x+25=0(x±5)2=0
Sure... but this doesn't satisfy the second definition, since this has two roots (−5,5).
Here is a perfect square trinomial (notice how it has only one root) that satisfies the second definition:
x2+6x+9=0(x+3)2=0x+3=0x=−3
set terminal svg size 300,200 enhanced font 'Verdana,10'
set xtics 1
set ytics 1
set xrange [-6:1]
set yrange [-1:6]
f(x) = x*x + 6*x + 9
plot f(x)
Here is an example of a perfect square trinomial whose root is not an integer (so it does not satisfy the first definition, but is still called a "perfect square trinomial"):
49x2−14x+149(x2−72x)+1Factor so that a=1 inside the parentheses
Next make the parentheses contain a perfect square trinomial. You'll do this by taking half of b (i.e. −72/2=−71) and squaring it. Then add and subtract that value.
49(x2−72x+(−71)2−(−71)2)+1
Now you have a perfect square trinomial. You can factor it into a squared binomial.
set terminal svg size 300,200 enhanced font 'Verdana,10'
set xtics 0.5
set ytics 0.5
set xrange [-0.5:1]
set yrange [-0.5:2]
f(x) = 49*x*x - 14*x + 1
plot f(x)
TODO: investigate more about how perfect squares (definition 1) and perfect square trinomials (definition 2) are related. Also think about the discriminant.
Here I'm just trying to find the roots of an arbitrary trinomial 4x2+5x+16 by completing the square:
If you forget why we do what we do to complete the square, start with a(x−h)2+k [i.e. the vertex form], multiply it out, step by step, and then reverse the process.
The subtracted (2b)2 is the missing square in the corner.
Therefore you need to "complete" the big square by adding a smaller square (2b)2 to the corner. You can do this by adding (2b)2 to both sides of the equation:
(x+2b)2−(2b)2+(2b)2=c+(2b)2(x+2b)2−(2b)2+(2b)2=c+(2b)2These two cancel out(x+2b)2=c+(2b)2E.g. (x+3)2=25
The smallest possible value of y is −4, since squaring always gives a positive number: (x−1)2≥0, so xmust be 1 so that we get the smallest y.
The x giving the smallest possible y is 1, so the lowest possible point is (1,−4)
The y-intercept can be found easily: just set x=0, which gives (0−1)2−4=−3
The roots, i.e. the values of x where y=0, can be found easily: y=(x−1)2−40=(x−1)2−4(x−1)2=4Solving for x...x−1=±2x={−1,3}Found the roots (x-intercepts)
How does varying a, b and c in ax2+bx+c affect the curve?
Varying a between [−3,3]:
(Notice how a=0 gives a straight line, i.e. y=0+mx+c.)
set xtics 1
set ytics 1
set xrange [-4:5]
set yrange [-6:6]
f(x) = -3*x*x + 0*x + 0
g(x) = -2*x*x + 0*x + 0
h(x) = -1*x*x + 0*x + 0
i(x) = 0*x*x + 0*x + 0
j(x) = x*x + 0*x + 0
k(x) = 2*x*x + 0*x + 0
l(x) = 3*x*x + 0*x + 0
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
Varying b between [−3,3]:
set xtics 1
set ytics 1
set xrange [-5:7]
set yrange [-4:8]
f(x) = x*x + -3*x + 0
g(x) = x*x + -2*x + 0
h(x) = x*x + -1*x + 0
i(x) = x*x + 0*x + 0
j(x) = x*x + x + 0
k(x) = x*x + 2*x + 0
l(x) = x*x + 3*x + 0
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
Varying c between [−3,3]:
set xtics 1
set ytics 1
set xrange [-5:5]
set yrange [-4:8]
f(x) = x*x + 0*x + -3
g(x) = x*x + 0*x + -2
h(x) = x*x + 0*x + -1
i(x) = x*x + 0*x + 0
j(x) = x*x + 0*x + 1
k(x) = x*x + 0*x + 2
l(x) = x*x + 0*x + 3
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
How does varying a, h and k in a(x+h)2+k affect the curve?
Varying h between [−3,3]:
(−h defines the x coordinate of the lowest point on the curve.)
set xtics 1
set ytics 1
set xrange [-6:9]
set yrange [-1:10]
f(x) = (x + -3)*(x + -3) + 0
g(x) = (x + -2)*(x + -2) + 0
h(x) = (x + -1)*(x + -1) + 0
i(x) = (x + 0)*(x + 0) + 0
j(x) = (x + 1)*(x + 1) + 0
k(x) = (x + 2)*(x + 2) + 0
l(x) = (x + 3)*(x + 3) + 0
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
Varying k between [−3,3]:
(k defines the y coordinate of the lowest point on the curve.)
set xtics 1
set ytics 1
set xrange [-4:5]
set yrange [-4:8]
f(x) = (x + 0)*(x + 0) + -3
g(x) = (x + 0)*(x + 0) + -2
h(x) = (x + 0)*(x + 0) + -1
i(x) = (x + 0)*(x + 0) + 0
j(x) = (x + 0)*(x + 0) + 1
k(x) = (x + 0)*(x + 0) + 2
l(x) = (x + 0)*(x + 0) + 3
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
Varying a between [−3,3]:
(a squeezes and widens the curve along the center line. Its sign determines whether the curve is U-shaped or an inverted U.)
(Notice how a=0 gives a straight line, just like with 0x2+bx+c, since 0(x−h)2+k=k.)
set xtics 1
set ytics 1
set xrange [-4:5]
set yrange [-4:8]
f(x) = -3*(x + 0)*(x + 0) + 0
g(x) = -2*(x + 0)*(x + 0) + 0
h(x) = -1*(x + 0)*(x + 0) + 0
i(x) = 0*(x + 0)*(x + 0) + 0
j(x) = 1*(x + 0)*(x + 0) + 0
k(x) = 2*(x + 0)*(x + 0) + 0
l(x) = 3*(x + 0)*(x + 0) + 0
plot f(x) title "-3", g(x) title "-2", h(x) title "-1", i(x) title "0", j(x) lt rgb "violet" title "1", k(x) title "2", l(x) title "3"
The quadratic formula
In addition to factoring and completing the square, this is another way to solve quadratic equations. It allows you to just plug in a, b and c, giving you x (the roots).
ax2+bx+c=0aax2+bx+c=a0Divide both sides by ax2+abx+ac=0x2+abx=−acMove to RHS(x+ab/2)2−(ab/2)2=−acComplete the square(x+2ab)2=(2ab)2−acMove to RHS(x+2ab)2=4a2b2−ac(x+2ab)2=4a2b2−4acx+2ab=±4a2b2−4acx+2ab=2a±b2−4acx=−2ab±2ab2−4acMove to RHSx=2a−b±b2−4acThe quadratic formula
Sum of the roots: if you add the two roots of a quadratic equation, you get a−b.
Product of the roots: if you multiply the two roots of a quadratic equation, you get ac.
When we either add or multiply any pair of roots, we get rid of the square root of the number b2−4ac. We therefore also get rid of any complications which might arise from trying to find this square root.
A quadratic equation always has two roots, if complex roots are included and a double root is counted for two.
set terminal svg size 400,300 enhanced font 'Verdana,10'
set xtics 1
set ytics 1
set xrange [-1:7]
set yrange [-3:6]
f(x) = x*x - 4*x + 6
g(x) = x*x - 4*x + 4
h(x) = x*x - 4*x + 2
plot f(x) title "b^2 - 4ac < 0", g(x) title "b^2 - 4ac = 0", h(x) lt 4 title "b^2 - 4ac > 0"
To see whether you should use the quadratic formula or not, see if b2−4ac gives you a perfect square or 0. If not, then factoring and completing the square will probably be lots of work, and you will have an easier time with the quadratic formula.
I'll try with x2−2x−3:
a=1b=−2c=−3x=2(1)2±(−2)2−4(1)(−3)=22±16={−1,3}Found the roots
Remember that most square roots are irrational ("surds"; e.g. 5), and not perfect squares (e.g. 4). Therefore finding the roots (i.e. x) of quadratics by factoring or completing the square can be impossible/difficult. That's why the quadratic formula is useful.
Find what you get if you add the two solutions or roots together. Can you connect this answer with the a, b and c of the particular equation in any way?
set xtics 1
set ytics 1
set xrange [-5:3]
set yrange [-7:4]
set label "x_1" at -3,0 offset 0.5,0.6
set label "x_2" at 0.5,0 offset 0.5,0.6
set label "(x_1 + x_2, c)" at -2.5,-3 offset 0.5,0.5
set label "(0, c)" at 0,-3 offset 0.5,0.5
$points << EOD
-2.5 -3
0 -3
-3 0
0.5 0
EOD
f(x) = 2*x*x + 5*x - 3
plot f(x), "$points" with points lt 6 pt 7 notitle
Graph for x2+10x+16:
set xtics 2
set ytics 2
set xrange [-12:4]
set yrange [-11:20]
set label "x_1" at -8,0 offset 0.5,0.6
set label "x_2" at -2,0 offset 0.5,0.6
set label "(x_1 + x_2, c)" at -10,16 offset 0.5,0.5
set label "(0, c)" at 0,16 offset 0.5,0.5
$points << EOD
-10 16
0 16
-2 0
-8 0
EOD
f(x) = x*x + 10*x + 16
plot f(x), "$points" with points lt 6 pt 7 notitle
Looks like x1+x2 gives the x coordinate of a point opposite to the y-intercept.
(b)
Find what you get if you multiply each of the pairs of roots together. Then again see if you can connect the results with the a, b and c of the particular equation.
2a−b−b2−4ac∗2a−b+b2−4ac=(2a−b−2ab2−4ac)∗(2a−b+2ab2−4ac)=Difference of two squares(2a−b)2−(2ab2−4ac)2=4a2b2−4a2b2−4ac=4a2b2−(b2−4ac)=4a2b2−b2+4ac=x1x2=ac
Here's another way to find those two equations is to start with a standard quadratic equation. Let α and β be the equation's two roots, i.e. x={α,β}. (Remember: the roots of a quadratic equation are often called alpha and beta, α and β.)
I had some difficulty remembering how to factor a trinomial with a>1. Rememberfactoring by grouping when factoring trinomials. It'll help you whenever a>1. Split b into p and q, such that pq=ac. Then group. Then factor the groups.
Now I have an equation that looks like a quadratic equation. How to solve for t?
s=−21gt2+ut2s=−gt2+2ut2s=−g(t2−g2ut)2s=−g((t−gu)2−(−gu)2)Complete the square inside the parentheses2s=−g(t−gu)2+g(g2u2)2s=−g(t−gu)2+gu22s−gu2=−g(t−gu)2−g22sg−u2=(t−gu)2−g22sg−u2=t−guUhh, square root of a negative...−g22sg−u2+gu=tg−2sg−u2+gu=t(There’s a mistake here)gu±−2sg−u2=t
−g22sg−u2=t−guUhh, square root of a negative...−g22sg−u2+gu=tg−(2sg−u2)+gu=tSquare root is no problem. Fixed the mistake...gu±−2sg+u2=tgu±u2−2sg=t
Remember: I made tens of small algebra mistakes in the math above and below. A couple of times I thought there was a more fundamental math principle going on, but it ended up being just a silly algebra mistake. Do more algebra!
Note: above I completed the square inside the parentheses, but I didn't "zero" the equation. I essentially did this:
x2−bx+c=0−bx+c=−x2c=−x2+bxc=−(x2−bx)c=−((x−2b)2−(−2b)2)Complete the square inside the parenthesesc=−((x−2b)2−4b2)c=(−1)(x−2b)2+4b2c−4b2=(−1)(x−2b)244c−b2=(−1)(x−2b)2−44c−b2=(x−2b)2−44c−b2=x−2b2b±−4c−b2=x
Remember: "zero" a quadratic equation before you complete the square. Completing the square is a bit more familiar that way. It also helps with simplifying the equation, since you can divide/multiply both sides without affecting the zero side at all, since 0 divided/multiplied by anything is 0.
So, I'll try this once more, this time setting one side to 0:
Remember: whenever you see a quadratic equation in the wild, and you need to solve for x, use the quadratic formula. That's much faster than completing the square.
t=gu±u2−2sg
Discriminant=u2−2sg
A ball is thrown in the air with initial velocity u=14. How long does it take to reach the height of s=5,10,15? Solving with JavaScript:
Reaches 5 meters at 0.4 seconds going up, and 5 meters at 2.4 seconds coming down
Reaches 10 meters at the top (vertex)
Never reaches 15 meters
Remember: the discriminant tells you whether there are real solutions to a quadratic equation. If it's <0, then you need imaginary numbers.
(3)
The curve is an upside down U on a graph, so the quadratic equation's a<0.
The vertex is at (1.4,10) (10 meters at 1.4 seconds). I can plug these values into the vertex form:
y=a(x−h)2+ky=a(x−1.4)2+10
What should a be (without computing it)? I'll try with the a that we saw above in the formula: −21g=−219.8=−4.9.
y=−4.9(x−1.4)2+10
set xtics 0.5
set ytics 1
set xrange [-1:4]
set yrange [0:12]
f(x) = -4.9 * (x - 1.4) * (x - 1.4) + 10
plot f(x)
y=−(x−1.4)2+10
Nice. What happens with a different a value?
set xtics 0.5
set ytics 1
set xrange [-1:4]
set yrange [0:12]
f(x) = -1 * (x - 1.4) * (x - 1.4) + 10
plot f(x)
Looks like it transforms the width of the curve along the center (vertex). (In the case of this exercise it affects the value of gravity, g, and the initial force, u.)
(4)
To know how long the ball is in the air, i.e. to go up and come all the way back down, I need the roots of the quadratic curve. Therefore I set the height to zero, s=0. (Similarly, when you first start factoring a quadratic equation ax2+bx+c=0, you aim to set the right-hand side, i.e. y, to 0, so that you can find the two x coordinates where y=0.)
t=9.814±142−2(0)(9.8)t={0,9.828≈2.8}
So the ball is in the air for 2.8 seconds (i.e. two times the vertex, 2h).
After 2.9 seconds the ball is below the thrower's hands:
s=ut−21gt2s=(14)(2.9)−21(9.8)(2.9)2≈−0.6
(5)
s=ut−21gt2t=gu±u2−2sg
What does ut−21gt2=0 mean here?
Answer: the height of the ball is zero: s=0. Solving this "zeroed" quadratic equation gives two x coordinates (i.e. roots):
The point where the ball is thrown, (x1,0)
The point where the ball is back in the thrower's hand, (x2,0)
The book gives a realization about how important zeroing and then factoring is, for finding the roots.
You have a "zeroed" equation, ut−21gt2=0
The x coordinate on a graph here is t, i.e. time
The y coordinate is s, i.e. height, which is 0
Then, factoring:
ut−21gt2=0t(−21gt+u)=0
To get s=0, we need either one of these:
t=0
The full equation looks like this: 0(−21g0+u)=0
−21gt+u=0
The full equation looks like this: t(0)=0
Note that if you rearrange −21gt+u=0, you get t=g2u
t=9.82(14)≈2.86 seconds of flight
Remember: this shows how important it is to "zero" an equation, and to factor it into a product of factors. You can then set any one of the factors to 0 to get one of the solutions. Each of the factors is a smaller "zeroed" equation in itself (see above). This is why the factored form of a quadratic equation is nice.
Factort(Factor−21gt+u)=0Set either factor to zero
The book asks a few calculus-like questions as a teaser:
When does the ball move fastest?
At the start (t=0) and at the end (t≈2.8), I think. That's when we have the fastest change in instantaneous speed (i.e. the largest change in y per x, i.e. the greatest slope).
A quadratic equation's parabola is symmetric — surely the speed is identical at the start (the initial velocity) and at the end.
When does it move slowest?
The speed is 0 at the highest point (vertex), when the slope is zero.
Can you estimate how fast it is going one second after it has been thrown up?
From a 3Blue1Brown video I know that I can discretize the x axis into several identical-width slices. For each of those slices I can draw a line that gives me the slope of the slice.
Slope: m=x2−x1y2−y1=ΔxΔy
The slope (and therefore the speed) is the rate of change of s per t:
v=ts
From the earlier calculations, the highest point is at (1.4,10).
Initial velocity is u=14 m/s. At t=0 I therefore have v=14 m/s.
At t=1.4 I have v=0 m/s.
s=−21gt2+ut
If there was no gravity, the speed at t=1 would be identical to the speed at t=0 (u=v=14 m/s), and s would increase linearly:
v=114=14Speed is constant
s=utHeight increases at constant speed
So, I need the speed at t=1. I need to draw a line to get a slope (i.e. a speed). I have the point (0,0). I need another point to draw a line. What is the height at t=1?
s=−21(9.8)(1)2+(14)(1)=9.1
v=19.1=9.1
Now I have a line from (0,0) to (1,9.1). I think this gives me the average speed between t=[0,1]. Will I get a different value if I split the graph into smaller slices of t?
Yep, I get a different value. The average speed between t3 and t4 is 5.44 m/s, and between t4 and t5 it's 2.96 m/s. Based on this I'd say the speed at t=1 is roughly 2v4+v5=4.2 m/s.
Ah, of course... I only need one slope, and therefore only two t steps (timesteps): one right beforet=1, and one right aftert=1.
The smaller Δt is, the better v will approximate the speed at t=1.
2.D.(h)
x2+5x+6=x2+x−24x+8=0x=−2
x2+5x+6=0(x+2)(x+3)=0x={−2,−3}
x2+x−2(x−1)(x+2)x={1,−2}
set xrange [-6:6]
set yrange [-3:9]
set xtics 1
set ytics 1
f(x) = x*x + 5*x + 6
g(x) = x*x + x - 2
h(x) = 4*x + 8
plot f(x) title "x^2 + 5x + 6", g(x) title "x^2 + x - 2", h(x) title "4x + 8"
x2−x−6=x2+3x−4−4x−2=0x=−21The x coordinate where the two quadratics cross
x2−x−6(x+2)(x−3)x={−2,3}
x2+3x−4(x+4)(x−1)x={−4,1}
set xrange [-6:6]
set yrange [-7:4]
set xtics 1
set ytics 1
f(x) = x*x - x - 6
g(x) = x*x + 3*x - 4
h(x) = -4*x - 2
plot f(x) title "x^2 - x - 6", g(x) title "x^2 + 3x - 4", h(x) title "-4x - 2"
2x2−8x+8=x2−4x+5x2−4x+3
2x2−8x+8x=2(2)8±(−8)2−4(2)(8)x=2
x2−4x+5x=2(1)4±(−4)2−4(1)(5)x=24±−4
x2−4x+3(x−1)(x−3)x={1,3}The two quadratics cross in two places, giving us two roots
set xrange [-2:8]
set yrange [-2:10]
set xtics 1
set ytics 1
f(x) = 2*x*x - 8*x + 8
g(x) = x*x - 4*x + 5
h(x) = x*x - 4*x + 3
plot f(x) title "2x^2 - 8x + 8", g(x) title "x^2 - 4x + 5", h(x) lt 4 title "x^2 - 4x + 3"
x2−6x+8=(x−2)(x−4)x2−6x+8=x2−6x+80=0x=x
Two identical quadratics on top of each other. They cross in all places on the curve (any value of x is possible). Remember: this kind of an equation is called an identity, and is often written with ≡ (i.e. \equiv in LaTeX).
set xrange [-1:8]
set yrange [-2:9]
set xtics 1
set ytics 1
f(x) = x*x - 6*x + 8
plot f(x) title "x^2 - 6x + 8"
Cubic equations
A.k.a. third degree polynomials.
2x3−5x2−6x+9=0
set xrange [-4:6]
set yrange [-8:12]
set xtics 1
set ytics 1
f(x) = 2*x*x*x - 5*x*x - 6*x + 9
plot f(x)
There is no simple formula for solving polynomials of degree >2, but there do exist (quite complex) formulas for degree 3 and 4.
The first method that the book gives is guessing one of the roots, and then solving the resulting quadratic polynomial to get the two remaining roots.
f(x)=3x3+2x2−12x−8
set xrange [-4:4]
set yrange [-16:6]
set xtics 1
set ytics 1
f(x) = 3*x*x*x + 2*x*x - 12*x - 8
plot f(x)
f(x)=3x3+2x2−12x−8f(1)=3(1)3+2(1)2−12(1)−8=0Not a rootf(2)=3(2)3+2(2)2−12(2)−8=02 is a root
It's easy to see what the leading coefficient and the last constant of "some quadratic here" should be:
f(x)=3x3+2x2−12x−8(x−2)(3x2+...+4)
What goes in the middle? Remember: you need the same number of xn terms on each side.
3x3+2x2−12x−8=(x−2)(3x2+...+4)
On the left I have 3x3, 2x2, and −12x.
On the right I have 3x3, −6x2, and 4x (after factoring).
Therefore I need 8x2 and −16x on the right.
The only way I can have 8x2 on the right (after factoring) is to have 8x in the middle (before factoring). x∗8x=8x2 and −2∗8x=−16x:
3x3+2x2−12x−8=(x−2)(3x2+8x+4)3x3+2x2−12x−8=3x3+8x2+4x−6x2−16x−8Checking the result3x3+2x2−12x−8=3x3+2x2−12x−8Checking the result
Remember: when you have an identity (an equivalence of two expressions), both sides must have an equal amount of xn terms, i.e. the coefficient p in pnxn must be the same on both sides. (I wrote pn because I wanted to make it clear that I'm talking about the coefficient p for only the xn value, and not all x values. For example: p3=3 and p1=12 in the above equation.)
In the example above, where you had to find out what to put in the middle in 3x2+...+4, you really only had to care about x∗8x and −2∗3x2, to get 2x2.
Surely there is an easier way than guessing? Can I just factor by grouping?
3x3+2x2−12x−8=0x2(3x+2)−4(3x+2)=0(3x+2)(x2−4)=0Expand the difference of two squares...(3x+2)(x+2)(x−2)=0
Found the roots (set each of the three factors above — i.e. the parenthesized expressions — to zero, one by one):
3(−32)+2=0−2+2=02−2=0x={−2,−32,2}
Note: I first tried to factor like this, but this doesn't work:
3x3+2x2−12x−8=0x(3x2+2x−12)−8=0x(0)−8=0Tried to set the factor to 0 to get one of the roots
Looks like you can't assume that the quadratic in the middle equates to zero. In other words, you can't "guess" one of the cubic equation's roots by solving a quadratic inside it.
Remember: you're trying to factor the polynomial equation axn+bxn−1...+c=0 (of degree n)
into a(x−rn)(x−rn−1)...=0 (i.e. the factored form).
The factored form only contains multiplication. It doesn't contain summands (e.g. −8 above). The factored form allows you to easily set each factor to 0 one by one, giving you each root of the polynomial.
2.E.1
f(x)=3x3+2x2−3x−2x2(3x+2)+(−3x−2)=0x2(3x+2)−(3x+2)=0(x2−1)(3x+2)=0Expand the difference of two squares...(x+1)(x−1)(3x+2)=0x={−1,1,−32}
f(x)=−2x3−3x2+3x+2x2(−2x−3)+(3x+2)=0−x2(2x+3)+(3x+2)=0−x2(2x+3)+(3x+2)=0I see no immediate way to factor further−(−2)2(2(−2)+3)+(3(−2)+2)=0But it’s easy to see that −2 is a root−(4)(−1)+(−4)=0(x+2)(−2x2+...+1)=0(x+2)(−2x2+x+1)=0(x+2)(−2x+2)(x+21)=0x={−2,1,−21}
Just out of curiosity, what do the factors (i.e. lower-degree polynomials) look like if I graph them? Are they related to the higher-degree polynomial in some visual way?
set xrange [-4:6]
set yrange [-8:12]
set xtics 1
set ytics 1
plot x + 2, \
-2 * x + 2, \
x + 0.5, \
-2*x*x + x + 1, \
-2*x*x*x - 3*x*x + 3*x + 2 lt 6
They obviously share the same roots. At least some of them have the same y-intercept. Some of them seem to intersect at (0.5,1).
Rational zero theorem
Remember: Rather than blindly guessing one of the roots of a polynomial equation of degree ≥3, you can apparently use the rational zero theorem (aka rational root theorem or p/q theorem). It says:
If you have a polynomial, e.g., ax3+bx2+cx+d=0
And the coefficients (a,b,c,d) are integers
Then x={Factor of aFactor of d,...}
In other words, the roots of this polynomial must have a numerator that is a factor of d, and a denominator that is a factor of a, with either a + or − sign.
Note: the factors include 1, i.e., x can be 1? or ?1.
To further trim down the list of possibilities, it's helpful to first treat x as 1, −1, 2, etc., to see what the remainder is. If none of those match, try fractions next. The remainder tells you have close you're to a root. 0 remainder is an exact match.
I'll try to use this to find one of the roots:
f(x)=4x3−15x2+12x+44x3−15x2+12x+4=0Some possibilities: 44,21,12,41,14(x−2)(4x2+...−2)=012 is a root (I checked by substituting x)(x−2)(4x2−7x−2)=0Remaining roots can now be found with the quadratic formulax=2(4)7±(−7)2−4(4)(−2)=87±9={−41,2}x={−41,2,2}
Remember: to find the roots of a cubic equation, first guess one root with the help of the rational zero theorem. That will factor the cubic equation into two polynomial factors: a linear and a quadratic. Then solve the quadratic with the quadratic formula to get the last two remaining roots.
f(x)=x3−3x2+3x−1x3−3x2+3x−1=0One of the roots must be 1 or -1(x−1)(x2−2x+1)=0(x−1)(x−1)(x−1)=0x={1,1,1}
Arithmetic division
In arithmetic, Euclidean division – or division with remainder – is the process of dividing one integer (the dividend) by another (the divisor), in a way that produces a quotient and a remainder smaller than the divisor. (Wikipedia)
a and b are integers. a is the dividend (a.k.a. the numerator). b is the divisor (a.k.a. the denominator). q is the quotient (i.e. the integer result in Euclidean division). r is the remainder.
E.g. 8=(3)(2)+2.
To see how we get that equation, let's say you have an integer a.
If you divide a by b, you can say:
ba=q+brE.g. 38=2+32
Multiply both sides by b:
a=bq+r
Polynomial division
A polynomial can also be split into a "whole part" (quotient) and a remainder.
Let's say you have a polynomial:
f(x)=ax3+bx2+cx+d
If you divide the whole polynomial by (x−k), you can say:
(x−k)f(x)=q(x)+(x−k)R
Then, if you multiply both sides of the equation by (x−k):
f(x)=q(x)(x−k)+R
R is the remainder of (x−k)f(x). Now you have an equation that is essentially the same as Euclid's division lemma, a=bq+r.
Arithmetic long division
This is the good old algorithm that was taught in elementary school.
(I added a faint 0 to the steps below, so that you can see how long division starts dividing from the largest degrees of ten, and how it gives you an increasingly accurate answer.)
Solve 267 / 7.
Solve 267 / 7.
_________
)
Solve 267 / 7.
_________
7 ) 267
Solve 267 / 7.
_________
7 ) 267 What number does 7 go into at least once?
Solve 267 / 7.
_________
7 ) 267 26 / 7
Solve 267 / 7.
_________
7 ) 267 26 / 7, record quotient 3 at top
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
Multiply the divisor (7) by the quotient (3)
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
3 * 7
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
--
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- Subtract the two stacked numbers
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21
50
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
50
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 Repeat the process for 57 (instead of 267)
Solve 267 / 7.
30
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
8 * 7
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
56 8 * 7
--
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
56 8 * 7
-- 57 - 56
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
56 8 * 7
-- 57 - 56
1
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
56 8 * 7
-- 57 - 56
1 Done. Remainder is 1 / 7.
Solve 267 / 7.
38
_________
7 ) 267 26 / 7, record quotient 3 at top
210 3 * 7
-- 26 - 21, bring down next number
57 57 / 7, record quotient 8 at top
56 8 * 7
-- 57 - 56
1 Done. Remainder is 1 / 7.
Result: 38 + 1/7
Some thoughts:
Long division is repeatedly dividing the largest-to-lowest degree number by the divisor, while keeping track of remainders
If you have 1000/7, you know that the result is at least 10, because 1000/10=100, and 7 is smaller than 10, so 7 divides 1000 into even smaller parts than 10 does
In other words: 1011∗103=102, and 7∗1001∗103>102
The long division algorithm gives you an increasingly accurate answer. This is because it starts the division from the largest (divisible) degree-of-ten:
Solve 71000.
Remember Euclid's division lemma: a=bq+r. The long division algorithm is using this multiple times in succession. Long division is a divide and conquer algorithm. Split the dividend into two parts: the quotientq (that the divisorb divides wholly) and the remainderr (that b does not divide wholly). Then repeat the long division for r. An example:
In code, a long division algorithm could look like this:
let dividend = 377209;
const divisor = 42;
const dividendMaxDegree = String( dividend ).length - 1;
let degreeDividend;
let remainder = 0;
let result = '';
// Go from the largest degree, e.g. 10^5, to 10^0
for ( let degree = dividendMaxDegree; degree >= 0; degree-- ) {
// E.g. floor(377209 / 10^3) = 377
degreeDividend = Math.floor( dividend / Math.pow( 10, degree ) );
// Reduce the degree until divisor <= degreeDividend.
// E.g. 42 > 3
// or 42 > 37
if ( divisor > degreeDividend ) {
continue;
}
// E.g. floor(377 / 42) = 8
const degreeQuotient = Math.floor( degreeDividend / divisor );
// Mark the integer quotient (e.g. 8) at the top of the long division
result += String( degreeQuotient );
// E.g. 377 - 8 * 42 = 41
remainder = degreeDividend - degreeQuotient * divisor;
// We're now ready to move to the next lower degree. This is the step
// in long division where the two stacked values are subtracted, and
// the algorithm starts from the beginning again.
// E.g. 377209 - 336000 = 41209
dividend -= ( degreeQuotient * divisor ) * Math.pow( 10, degree );
output( degreeDividend +' / '+ divisor +' = '+ degreeQuotient +' R '+ remainder );
output( 'The correct answer is '+ result + '<i>0</i>'.repeat( degree ) +' + '+ dividend +'/'+ divisor );
}
Notice how the algorithm incrementially increases the accuracy of the integer quotient, and reduces the remainder. Also notice how the algorithm always uses the previous remainder as the new dividend.
A thought: all numbers can be represented as a(10n)+b(10n−1)+…+z(100).
For example: 243=2(102)+4(101)+3(100).
That looks like this quadratic function: 2x2+4x+3=243
Or, the same function zeroed: 2x2+4x−240=0
One of the roots is obviously 10, since I chose 243 to be a base-10 number above.
But I know that each polynomial of degree n has n roots. After solving for x with the quadratic formula, I find that there is another root (or negative base), −12, that gives the same number:
If you know one of the factors of a polynomial, e.g. (x−1)(Other factors here), you know one of the roots of the polynomial, e.g. 1.
Factor theorem: a polynomial f(x) has a factor (x−k) if and only if f(k)=0 (i.e. k is a root).
If you know one of the roots of the polynomial, e.g. x=1 (that is, f(1)=0), you know one of the factors of the polynomial, e.g. (x−1).
To check whether some (x−k) is a factor of a polynomial (and whether k is one of its roots), you can use polynomial long division.
Polynomial long division (just like arithmetic long division) will give you the remainder of doing the division. If the remainder is 0, then (x−k) is a factor of the polynomial, and k is a root.
Polynomial long division is slow, though. Remember: you don't have to do polynomial long division to find out if (x−k) is a factor (and if k is a root) in your polynomial f(x). Instead:
Just evaluate r=f(k) for some k (e.g. a guess)
If r=0, then k is a root
Why is this important? Why worry about algebraic long division and these theorems? Remember:apparently algebraic fractions come up often in engineering and elsewhere in the real world.
If you see a fraction like x−23x3−4x2+5x−2 in the real world, it's not immediately apparent if it can be simplified, and how — but the factor theorem helps [although it's easier to just do polynomial long division, as I wrote further down]:
y=x−23x3−4x2+5x−2Is 2 a root? Let’s test.
3(2)3−4(2)2+5(2)−2=16No. Can’t simplify further.
Although... now I know that r=16, i.e. the numerator looks like 3x3−4x2+5x−2=16.
Therefore I should be able to "zero" the polynomial in the numerator, and "extract" the remainder out of the now-zeroed polynomial (so that the whole fraction still stays the same).
3(2)3−4(2)2+5(2)−18=0Yep, 2 is now a root
y=x−23x3−4x2+5x−18+x−216
Therefore we have an implicit (x−2) as a factor in the numerator, and we can simplify:
y=x−23x3−4x2+5x−18+x−216
y=x−2(x−2)(3x2+2x+9)+x−216
y=3x2+2x+9+x−216
I did the conversion from 3x3−4x2+5x−18 to (x−2)(some quadratic here) manually (without polynomial long division), but it took some time. It's probably better to just always do polynomial long division, since it requires less thinking.
Remember: when dividing one polynomial by another, just use polynomial long division. It gives you a simplified polynomial, plus a remainder. Using the factor theorem to try to avoid having to do polynomial long division is actually more work, as seen above.
Algebraic fractions
3x2−x−29−4x=x−11−3x+27
As for polynomial remainders, those are also useful. It comes up a lot in engineering when you look at a fraction of one polynomial divided by the other; a lot of the time, it's much easier to have a simple polynomial plus a proper fraction (which will tend to zero for sufficiently large values of x). (Reddit)
If the denominator has a higher degree, we call it a proper fraction (because the denominator doesn't go fully into the numerator). Otherwise it's an improper fraction.
See "Partial fraction" on WolframAlpha for more examples.
r can also be used to approximate roots iteratively — the smaller the remainder r, the closer you are to a root. An example:
Find an approximation for one of the roots of 2x3+6x2+7x+9.
var func = (x) => 2*x*x*x + 6*x*x + 7*x + 9;
var approximationIterationsLeft = 10;
var minI = -5;
var step = 1;
for ( var i = minI; i < 1000; i += step ) {
var remainder = func( i );
output( ( 'f('+ i +') ' ).padEnd( 15, ' ' ) +' = '+ remainder );
if ( remainder === 0 ) {
output( 'Found a root: '+ i );
output( 'Therefore (x '+ ( i < 0 ? '+' : '-' ) +' '+ Math.abs( i ) +') is a factor.' );
break;
}
if ( remainder > 0 ) {
if ( --approximationIterationsLeft <= 0 ) {
output( 'Found an approximate root: '+ i.toFixed( 3 ) );
output( 'Therefore (x '+ ( i < 0 ? '+' : '-' ) +' '+ Math.abs( i ).toFixed( 3 ) +') is an approximate factor.' );
break;
}
step /= 2;
i = minI;
}
else {
minI = i;
}
}
2.E.(d)
Example 2
Given that (x−4) is a factor of f(x)=6x3+ax2+bx+8 and that the remainder when f(x) is divided by (x+1) is −15, find a and b and the other two factors.
f(x)=6x3+ax2+bx+8f(4)=06(4)3+42a+4b+8=0
384+16a+4b+8=016a=−392−4b
I think I can't solve a or b yet. Need to try something else.
Can I use a simultaneous equation now? Let's see. I have three variables, so I'll need three equations.
a−v=−24b+4v=−2
What to use as the third equation? Well, from the beginning, I know this:
384+16a+4b+8=0
(At this point I realize that I could've solved a and b immediately with two simultaneous equations, but I'll run through these three equations first.)
a−v=−24b+4v=−216a+4b=−392
Remember: when solving simultaneous equations of three variables or more (i.e. three equations or more), do this:
Pick any pair of equations and solve for one variable.
Pick another pair of equations and solve for the same variable.
You have created a system of two equations in two unknowns. Solve the resulting two-by-two system.
Solve for b:
4a−4v=−96b+4v=−2
4a+b=−98
Now I have an equation with variables a and b. Then next step is to combine it with our other equation that has a and b, and solve that simultaneous equation.
4a+b=−9816a+4b=−392
4a+b=−984a+b=−98
OK, looks like I won't get anywhere with this approach. The reason is that all of my variables are from the same exact equation: 6x3+ax2+bx+8=(x−k)(ux2+vx+w)
I need to have two different equations to solve a system of equations. Above, the non-factored form 6x3+ax2+bx+8 and its factored form (x−k)(ux2+vx+w) were the same equation.
Remember: when you're solving simultaneous equations, you need to have different equations. If you put the same equation in different forms to the same system of equations, then your solutions to the system of equations will all result in 0=0, which means the problem has an infinite number of solutions. You're essentially drawing the same equation on a graph twice.
(I'll now proceed with the realization I had earlier.)
Starting all the way from the beginning, we have:
6(4)3+a(4)2+b(4)+8=06(−1)3+a(−1)2+b(−1)+8=−15
This should be solvable as a simultaneous equation.
384+16a+4b+8=0−6+a−b+8=−15
16a+4b=−392a−b=−17
4a+b=−98a−b=−17
5a=−115a=−23
Then, solving for b via substitution:
a−b=−17b=a+17b=−6
Check with the other equation:
4a+b=−984(−23)−6=−98
Now we now the full cubic polynomial: 6x3−23x2−6x+8=0. To find the other two factors (i.e. the two roots in addition to 4), I can use polynomial division and the quadratic formula.
Remember: when you have a factored polynomial like (x−k)(polynomial of degree ≥2), e.g. (x−4)(6x2+...+8), just use polynomial long division, rather than trying to eyeball what the (polynomial of degree ≥2) should look like. Polynomial division is less error-prone, and probably faster, as long as you remember how to do it.
Example 3
Suppose you have been asked to show that x2−4 is a factor of 3x3+4x2−12x−16. Can you see that you have actually been asked about two factors? What are they?
The first thing that hits my eye is the difference of two squares.
Since the cubic has two factors, (x+2) and (x−2), one of these factors should also be a factor in the quadratic. Take one factor for the cubic, and use the other factor to simplify the quadratic.
Trying to guess a root by using the rational zero theorem, but by always trying some integers first. I'll first try x=1 to see if I need an x that is less or greater than 1.
f(x)=3x3+x2−12x−4=03+1−12−4=−12
I need a larger x, or a negative x that is less than −1. How about 2?
f(x)=3x3+x2−12x−4=024+4−24−4=0
One of the factors is (x−2), i.e., (x−2)(A quadratic). Find the quadratic with long division.
Remember: you know the two roots of the quadratic: −31 and −2. How do you find the factors? (x+31)(x+2) is incorrect. Be careful here. Remember that the factored form of a quadratic is a(x−r1)(x−r2). In the quadratic we have a=3. Therefore the factors are 3(x+31)(x+2), or, in other words, (3x+1)(x+2).