# Two Questions I Have About My L.A. Textbook

My first question is about a formula for the y intercept of a linear equation, given you know two points that the line goes through. I Googled but no luck - it's hard to type a formula into Google.

The formula is: b = (y1*x2 - y2*x1)/(x2 - x1)

The textbook author left this as an "exercise" to derive, but I don't understand where it comes from.

Thanks.

Last edited by a moderator:

Related Linear and Abstract Algebra News on Phys.org
tnich
Homework Helper
The first thing you need to do for each problem is draw a picture showing everything you know about it. So let's start with the first problem. Draw x and y axes, draw a line. Since you don't know the exact equation of the line, label the line with the general equation of a line (slope and intercept are unknown parameters). Mark two points on the line and label them ##(x_1,y_1)## and ##(x_2,y_2)##. This ought to suggest a next step.

• StoneTemplePython and gibberingmouther
The first thing you need to do for each problem is draw a picture showing everything you know about it. So let's start with the first problem. Draw x and y axes, draw a line. Since you don't know the exact equation of the line, label the line with the general equation of a line (slope and intercept are unknown parameters). Mark two points on the line and label them ##(x_1,y_1)## and ##(x_2,y_2)##. This ought to suggest a next step.
Okay, I didn't want to appear dumb so I cheated. I did try first though. Anyway, I see how to derive it now but am still a little lacking in confidence in my understanding of how the derivation works. So we have y = mx + b -> y = (y2 - y1)/(x2-x1) * x + b. I see that you can evaluate this equation at (x1, y1) or (x2, y2) and come up with the formula I was trying to derive. M is just the slope - I've graphed enough equations that this part makes perfect sense to me. So we can evaluate the equation at an arbitrary point (x1, y1) or (x2, y2) - we have to choose one of those so the math will work out. And it doesn't matter which points you choose, b will always be the same? I guess I'm okay with this, but I had to talk my way through it first. Like the rubber duck effect, my favorite thing ever that works even outside computer science, though my dad is probably tired of me using him as my duck :)

tnich
Homework Helper
You have made yourself believe the answer, but you still have not derived it. I think the text book author's intention in leaving the derivation as an exercise for the reader was to let you apply some of the knowledge you have picked up in your reading about linear algebra.

So, after drawing the picture, what's your next step?

tnich
Homework Helper
You have made yourself believe the answer, but you still have not derived it. I think the text book author's intention in leaving the derivation as an exercise for the reader was to let you apply some of the knowledge you have picked up in your reading about linear algebra.

So, after drawing the picture, what's your next step?
You want to get a linear equation that you can solve with matrix algebra.

• gibberingmouther
y = mx + b -> y1 = (y2 - y1)/(x2 - x1)*x1 + b -> b = (-y2x1+y1x1)/(x2 - x1) + y1(x2 - x1)/(x2 - x1) -> b = (y1x2-y1x1-y2x1+y1x1)/(x2 - x1) -> b = (y1x2-y2x1)/(x2 - x1)

I usually check the math myself using my notepad by my computer. I'm not math illiterate, I can do basic algebra. I actually took linear algebra and up to Calculus II and statistics. It's been awhile though. I was pretty good at algebra at one point (I won't brag about my math SAT lol though I will say I brought it up 160 points by studying! very proud of that) but if you don't use it, you lose it i guess. Right now I'm trying to understand the way to do "polynomial interpolation" but i'm having some trouble. I know I'll get it, it just might take me a little bit (like I'll probably have something to say by tomorrow).

tnich
Homework Helper
y = mx + b -> y1 = (y2 - y1)/(x2 - x1)*x1 + b -> b = (-y2x1+y1x1)/(x2 - x1) + y1(x2 - x1)/(x2 - x1) -> b = (y1x2-y1x1-y2x1+y1x1)/(x2 - x1) -> b = (y1x2-y2x1)/(x2 - x1)

I usually check the math myself using my notepad by my computer. I'm not math illiterate, I can do basic algebra. I actually took linear algebra and up to Calculus II and statistics. It's been awhile though. I was pretty good at algebra at one point (I won't brag about my math SAT lol though I will say I brought it up 160 points by studying! very proud of that) but if you don't use it, you lose it i guess. Right now I'm trying to understand the way to do "polynomial interpolation" but i'm having some trouble. I know I'll get it, it just might take me a little bit (like I'll probably have something to say by tomorrow).
I see that you have used your knowledge of the slope to derive the formula for the intercept. If you want to solve the polynomial problem, though, you will need a different approach. If you can work through this approach on the first problem, it will seem much easier on the second problem.

So continuing with the first problem, try this. Start with the equation ##y=mx+b## for the line. Plug in your two sets of values for ##x## and ##y## to get two linear equations with m and b as the unknowns. Now you will have two equations in two unknowns that you can solve using linear algebra.