**1**

# Calculate Slope with only three points?

###
#2
Moderators - Reputation: **8161**

Posted 13 June 2012 - 09:48 PM

###
#3
Members - Reputation: **1240**

Posted 13 June 2012 - 09:49 PM

Nope. There are an infinite number of lines that run through point (x1,y1) and cross the axis x=x2. tan() won't help you here, since tan() is a ratio of rise/run (slope), but the numerator includes an unknown. If you know the angle of the line you could calculate it, otherwise you need more information.

say the angle is 27.5 degrees... How would I use that with the 3 coordinates?

Thanks

###
#4
Moderators - Reputation: **8161**

Posted 13 June 2012 - 10:02 PM

the sin() of Angle is calculated as Opposite/Hypotenuse (S=O/H)

the cos() of Angle is calculated as Adjacent/Hypotenuse (C=A/H)

the tan() of Angle is calculated as Opposite/Adjacent (T=O/A)

If your line is the hypotenuse in the above triangle, and the Angle=27.5 degrees, then it follows that tan(27.5) = O/A. Side A represents the length of the distance between x1 and x2, side O represents the distance between y1 and y2. So:

tan(27.5) = (y2-y1) / (x2-x1)

Rearrange and solve for y2 (the unknown):

tan(27.5)*(x2-x1)+y1=y2

###
#5
Crossbones+ - Reputation: **1715**

Posted 14 June 2012 - 12:34 AM

If you're talking about two x co-ordinates and one y co-ordinate... that's 1.5 points. Not possible at all. It's not really a situation which comes up often. You can see it by trying to sketch it on paper. To have a slope you need a line. How do you draw a line with less than two points?

If you indeed have a situation where this is a valid question, we need more background on how you ended up in this situation. Sometimes an assumption can be made, or other known data can be used.

###
#7
Members - Reputation: **722**

Posted 14 June 2012 - 03:42 PM

You can set ? to any value and create a line, but there is no single specific line.

If you have an angle already, then JTippets post explains how to solve for ?.

###
#8
Crossbones+ - Reputation: **6966**

Posted 14 June 2012 - 03:59 PM

_{1}, y

_{1}), and B (x

_{2}, R), where R is unknown, is simply:

m = (R - y

_{1}) / (x

_{2}- x

_{1})

If you don't know R, you

**cannot**find m, as others have said. It's like if I tell you j = k, and ask you to find j. You can't. Not without knowing k first.

Think of it like this: B is a line in the form x

_{2}(or in other words, it's a vertical line at x

_{2}). Start at point A. Now look at your vertical line B. There are an

**infinite**number of ways to draw a line from A to B, seeing as B is infinitely long.

**Edited by Cornstalks, 14 June 2012 - 04:00 PM.**

###
#10
Crossbones+ - Reputation: **1715**

Posted 14 June 2012 - 06:32 PM

So point being is you need to know at least 4 points then... e.g. 3 points define a line, 4 define slope then...

No, your terminology is wrong. A point is two co-ordinates (x and y). You need two points to make a line. A line has a slope. When you have one point plus a single co-ordinate it is impossible to draw a line, so you can't have a slope. Or to be more accurate you could draw an infinite number of lines. Seriously, sketch it on paper and you'll get it.

###
#11
Crossbones+ - Reputation: **6966**

Posted 14 June 2012 - 06:34 PM

**not**points.

*Together*, they make up a

**single**point, P. You need

**both**of them to have

*one*point.

2 points make up a line (in 2D our case, this requires

**4**values). Once you have a line, you can find the slope (no additional points required).

If you do not have two points, you do not have a line. If you are missing one of the coordinate values, it is

**not**a point (i.e. (x, ?) is

**not**a point). You need

**two**values to have a point, and you need

**two**points (

**four**values) to have a line, and you need a line to have a slope.

**Edited by Cornstalks, 14 June 2012 - 06:37 PM.**