Author Topic: why solve simultaneous equation for straight line when we already have 2 points?  (Read 1812 times)

0 Members and 1 Guest are viewing this topic.

Offline AlfBazTopic starter

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
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 points
Why 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.3
http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Congratulations!

You have just done Gaussian Elimination on the two simultaneous equations informally.

m*x1 + b = y1
m*x2 + b = y2

Subtract the equations:

m*(x1-x2) = (y1-y2)
m = (y1-y2)/(x1-x2)
 
The following users thanked this post: AlfBaz, Tom45

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
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.



 
The following users thanked this post: AlfBaz

Offline AlfBazTopic starter

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
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 lines
On 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 :-//
 

Offline AlfBazTopic starter

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
...
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.
Agreed, very useful indeed
 

Offline Tom45

  • Frequent Contributor
  • **
  • Posts: 556
  • Country: us
I understand both methods end in the same answer, what I don't understand is why use the seemingly inappropriate technique :-//

It 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.
 
The following users thanked this post: AlfBaz, mathsquid, WattsThat

Online IanB

  • Super Contributor
  • ***
  • Posts: 11892
  • Country: us
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 points
Why not just calculate m from the difference of the 2 points and then substitute one of the points to get b?

Because 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.
 
The following users thanked this post: AlfBaz

Online RoGeorge

  • Super Contributor
  • ***
  • Posts: 6203
  • Country: ro
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 points
Why 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.3
http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf

Looks 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.
 
The following users thanked this post: AlfBaz

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
[Looks 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.

But 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.
 

Offline JohnnyMalaria

  • Super Contributor
  • ***
  • Posts: 1154
  • Country: us
    • Enlighten Scientific LLC
m is the mountain you have to climb
b is the butt you have to kick
 
The following users thanked this post: AlfBaz

Offline AlfBazTopic starter

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
It's been 35+ years since I studied math and I barely remember algebra  :palm:

The one thing I do remember is having drilled into us to show ALL workings, 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 subject

Take Bruce's example
It's not immediately obvious how he got to

m*(x1-x2) = (y1-y2)

from

m*x1 + b = y1
m*x2 + b = y2

Unless 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 I did remember tripped me up

Having read all your replies I now get why it was done this way. 2 data points inserted into the same equation yields 2 simultaneous equations
Thank you all for your patience


 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3719
  • Country: us
Take Bruce's example
It's not immediately obvious how he got to

m*(x1-x2) = (y1-y2)

from

m*x1 + b = y1
m*x2 + b = y2

He 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.
 
The following users thanked this post: AlfBaz

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5236
  • Country: us
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.
 
The following users thanked this post: AlfBaz

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11653
  • Country: my
  • reassessing directives...
Having read all your replies I now get why it was done this way. 2 data points inserted into the same equation yields 2 simultaneous equations
the 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
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline wizard69

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: us
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.



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 points
Why 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.3
http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf