Using linear regression to find the intersection of two lines


Using linear regression to find the intersection of two 2-d

Linear regression can be used to find the line through two
2-d points as follows:

1. Clear the stats.
2. Do y1 ENTER x1 sigma+.
3. Do y2 ENTER x2 sigma+.

Then (on the 33s), do L.R.; the line is y = m*x + b, with m
and b displayed.

To get the value into the x-reg, get the value displayed
and press ENTER.

Since, projectively, two lines determine a point just as
well as two points
determine a line, we should be able to use linear
regression to determine
the intersection of two lines.

The problem is to determine a representation of lines such
that we can easily
enter the representations of two lines and get their

L.R. is given (xi, yi) (i = 1..2) and returns (m, b).
We would like to enter (mi, bi) (i=1..2) and get (x, y).

We can't quite do this, but if we write b = -x*m + y, we
see that b corresponds
to y and -m corresponds to x.

That is,
y = m*x + b
b = x*(-m) + y

So, if we enter (-mi, bi) for each line as the (x, y) input
for sigma+,
we should get x for m and y for b from L.R.

Example: Find the intersection of y=6x-1 and y=3x+2.

The (m, b) values are (6, -1), (3, 2), so we enter (-6, -1)
and (-3, 2)
(i.e., CLEAR sums(4) -1 ENTER -6 sigma+ 2 ENTER -3 sigma+).
The result is m=1, b=5, so the intersection is (1, 5)


Martin Cohen


Very clever, Martin!

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP prime: linear solver app Alberto Candel 1 1,042 11-21-2013, 01:57 AM
Last Post: Michael Carey
  HP Prime: Linear Solver app bug BruceH 0 786 11-15-2013, 06:36 PM
Last Post: BruceH
  HP Prime - Geometry App Intersection bluesun08 2 1,112 11-10-2013, 07:52 AM
Last Post: bluesun08
  Prime cant find Memory available Dougggg 5 1,618 10-07-2013, 07:24 PM
Last Post: Han
  HP Prime can't find how to use partfrac function ! dg1969 3 1,155 10-04-2013, 09:25 PM
Last Post: Joe Horn
  OT - A lucky find - Busicom Handy-LE LE-120A Cristian Arezzini 2 1,345 09-26-2013, 04:43 AM
Last Post: Cristian Arezzini
  Challenge(?): Intersection curve between two cylinders in a specific position Pier Aiello 15 3,266 09-17-2013, 05:58 PM
Last Post: Pier Aiello
  Quadratic & Cubic Regression RPN progs Matt Agajanian 9 2,269 09-17-2013, 11:37 AM
Last Post: Jeff O.
  New article on a new type of neo linear equations Namir 0 1,074 08-11-2013, 10:27 AM
Last Post: Namir
  Linear Optimization/Programming fhub 14 3,067 08-04-2013, 06:27 AM
Last Post: fhub

Forum Jump: