why solve simultaneous equation for straight line when we already have 2 points? - Page 1
Forum section: electronics / beginners

author: AlfBaz
author_rank: Super Contributor
timestamp: January 20, 2021, 05:01:29 am
content: I wanted to know why the author of this book uses simultaneous equations to solve for m and b in a straight line equation when he has 2 pointsWhy not just calculate m from the difference of the 2 points and then substitute one of the points to get b?Is he giving us a methodology that will suit more complex scenarios down the track?Page 60, section 4.3http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf

author: brucehoult
author_rank: Super Contributor
timestamp: January 20, 2021, 05:55:15 am
content: Congratulations!You have just done Gaussian Elimination on the two simultaneous equations informally.m*x1 + b = y1m*x2 + b = y2Subtract the equations:m*(x1-x2) = (y1-y2)m = (y1-y2)/(x1-x2)

author: rstofer
author_rank: Super Contributor
timestamp: January 20, 2021, 08:32:37 pm
content: I think it is just a very formal way of solving the 2 equations because, in the end, we need both m and b and they can be negative, zero or positive.You are at my favorite part of that book where it deals with offset and gain. Many times we want to expand a scale and subtract an offset. Maybe I want to measure a 12V battery over the range of 10V to 15V. I want that 5V delta to fill up the capabilities of my 5V ADC. I don't want to have the first 10V use of 2/3 of the range. Or maybe I want to scale that 5V range over a 3.3V ADC. I need to offset by -10V (the 'b' value) and rescale with the 'm' value.

author: AlfBaz
author_rank: Super Contributor
timestamp: January 20, 2021, 09:56:54 pm
content: That's great guys but if I'm thinking straight lines and simultaneous equations, I'm thinking we're looking for an intersection of 2 or more linesOn the other hand if I'm given two x,y points and looking for a single straight line then the classic gradient formula comes to mind.I understand both methods end in the same answer, what I don't understand is why use the seemingly inappropriate technique

author: AlfBaz
author_rank: Super Contributor
timestamp: January 20, 2021, 10:00:55 pm
content: Quote from: rstofer on January 20, 2021, 08:32:37 pmAgreed, very useful indeed

author: Tom45
author_rank: Frequent Contributor
timestamp: January 20, 2021, 10:51:29 pm
content: Quote from: AlfBaz on January 20, 2021, 09:56:54 pmIt isn't really inappropriate. If the goal is to find two unknown values, you know you need two equations in order to find those two unknowns.What you want to use is just a different form of those same two equations. But you still have to use two equations.

author: IanB
author_rank: Super Contributor
timestamp: January 20, 2021, 11:04:37 pm
content: Quote from: AlfBaz on January 20, 2021, 05:01:29 amBecause as others have said, calculating m from the difference of two points and then substituting to get b is in fact solving two simultaneous equations.The difference is that the way shown in the book is visible and intuitive. If anyone should forget how to do it, they can always write it down on paper to refresh their memory and be sure to get it right.However, they shortcut trick you mention relies on correct and accurate memory. You have to remember that "m" is the slope, which equals rise over run, and you have to think about what is rise and what is run (and not accidentally calculate run over rise). And you may remember that "b" is the intercept, but is it the x intercept or the y intercept?You can do it that way, but the only way to discover that method is to solve the two simultaneous equations in the first place. What you perceive as simpler, is in fact more complicated.For what it's worth, I would always use the methodology in the book when faced with such problems, because I trust my ability to deduce things more than my ability to remember things. My notebooks are full of pages where I work things out from first principles to refresh my memory of the formulas.

author: RoGeorge
author_rank: Super Contributor
timestamp: January 20, 2021, 11:54:31 pm
content: Quote from: AlfBaz on January 20, 2021, 05:01:29 amLooks to me like unnecessary algebraic solving instead of intuitive geometric solving. Nothing deep there, just tedious style. Could have been plotted a line through two points and explain the whole section in one or two paragraphs.

author: rstofer
author_rank: Super Contributor
timestamp: January 21, 2021, 02:08:52 am
content: Quote from: RoGeorge on January 20, 2021, 11:54:31 pmBut you would have had to geometrically extend the line to the Y axis to get the y-intercept, the 'b' value. Graphic solutions are quick but they aren't as accurate.

author: JohnnyMalaria
author_rank: Super Contributor
timestamp: January 21, 2021, 02:17:52 am
content: m is the mountain you have to climbb is the butt you have to kick

author: AlfBaz
author_rank: Super Contributor
timestamp: January 21, 2021, 05:04:00 am
content: It's been 35+ years since I studied math and I barely remember algebraThe one thing I do remember is having drilled into us to showALLworkings, no shortcuts.I suspect the reason behind this was to avoid the teachers burning out when marking paperwork trying to figure out what we did.If this was the case for people doing math for a living you can imagine what it's like for people who sporadically touch on the subjectTake Bruce's exampleIt's not immediately obvious how he got tom*(x1-x2) = (y1-y2)fromm*x1 + b = y1m*x2 + b = y2Unless you realize that manipulating the latter 2 equations you can get them to both equal b allowing you to rearrange to get the final equation.Unfortunately I don't always see the connection leaving me to wonder how they got there.In this instance something Ididremember tripped me upHaving read all your replies I now get why it was done this way. 2 data points inserted into the same equation yields 2 simultaneous equationsThank you all for your patience

author: ejeffrey
author_rank: Super Contributor
timestamp: January 21, 2021, 05:22:09 am
content: Quote from: AlfBaz on January 21, 2021, 05:04:00 amHe gave you the steps. You subtract the two given equations. He didn't specify, but you just subtract LHS from LHS and RHS from RHS.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: January 21, 2021, 06:10:12 am
content: Little advantage when a human is present. But for automated solutions the method keeps track of the sign of the slope and other things that a human picks up visually but mean nothing to a computer. There are lots of ways to skin the cat, but if you aren't there supervising the calculation an algorithm is necessary.The general concept is also good to have in your toolbox and helps as you move into higher order equations, statistical solutions and other more complex problems.

author: Mechatrommer
author_rank: Super Contributor
timestamp: January 21, 2021, 06:43:45 am
content: Quote from: AlfBaz on January 21, 2021, 05:04:00 amthe equation is 4 unknowns ie, mx+b=y (m,x,b,y). x and y can be known (we have plenty from graph) leaving us with unknowns m and b... 2 unknowns need 2 equations to solve, ie 2 data points. you can make 3 or 4 equations but that will be redundant... and then solving it using elimination...http://mathsfirst.massey.ac.nz/Algebra/SystemsofLinEq/EMeth.htm

author: wizard69
author_rank: Super Contributor
timestamp: January 21, 2021, 10:56:16 pm
content: It is interesting that you post this as just keyed up a little program in Excel, possibly for the hundredth time, to apply a slope function to a transducer input. This time I just used Excels slope and intercept function calls and went on my merry way. Not being a math wizard I can't even remember how I did this in the past, though it likely required that I reference a book. So I can't offer any input on the authors approach, it has been 40 years since I took part in a math class.In any event thanks for the link. As I quickly approach the end of my steady work life, I'm hoping to have more time for the fun aspects of electronics. That op-amp reference looks like a good refresher.Quote from: AlfBaz on January 20, 2021, 05:01:29 am