# Thread: Deriving a straight line equation from its slope and distance from origin

1. ## Deriving a straight line equation from its slope and distance from origin

Hello everyone.
The only data I have about a straight line is its slope and distance from origin.
I know that it's easy to use slope to obtain the angular coefficient m if I want line in the form y + mx +c.
Anyway, I still have no idea about how to find y-intercept c.
Do you know how I could do that?
Alternatively, do you know another way to get line's equation starting from slope and distance?

Thanks for help.

2. Originally Posted by ubisum
Hello everyone.
The only data I have about a straight line is its slope and distance from origin.
I know that it's easy to use slope to obtain the angular coefficient m if I want line in the form y + mx +c.
Anyway, I still have no idea about how to find y-intercept c.
Do you know how I could do that?
Alternatively, do you know another way to get line's equation starting from slope and distance?

Thanks for help.
I am assuming that means - perpendicular distance from the origin.

If that is the case - draw sketch of a line with x-intercept = a and y-intercept = b

m = tan(180 - Θ) = -b/a

Drop a perpendicular from the origin (O) to the line - intersecting at P. We know OP = k (given distance)

and continue .....

3. Originally Posted by Subhotosh Khan

I am assuming that means - perpendicular distance from the origin.

If that is the case - draw sketch of a line with x-intercept = a and y-intercept = b

m = tan(180 - Θ) = -b/a

Drop a perpendicular from the origin (O) to the line - intersecting at P. We know OP = k (given distance)

and continue .....

would you explain better how to derive intercept on Y axis, starting from OP distance?

4. Alright so, if you know the slope of the line, and Subhotosh Khan is correct that by "distance from the origin" you actually mean "perpendicular distance from the origin," then let's look at how to find the y-intercept. One form of a line is: Ax + By + C = 0. If you know the slope, then you know A and B (Remember: the slope is A/B), and the only unknown is the y-intercept, or C. Now you also know the perpendicular distance from the origin. The perpendicular distance from a line to a point (m, n) is:

$d=\frac{\left|Am+Bn+C\right|}{\sqrt{A^2+B^2}}$

Plugging in (0,0) as the point, we get:

$d=\frac{\left|C\right|}{\sqrt{A^2+B^2}}$

As established, you know A and B, so solve for C using the known distance d.

5. Always easier (I find) if you set one up for yourself...
Got a ruler, pencil, eraser and graph paper?

Draw straight line intersecting x-axis at B(15,0), y-axis at A(0,20).
Make origin C(0,0).
Place point P on AB, such that CP is perpendicular to AB.
This means CP = 12.

Slope of AB = (20 - 0)/ (0 - 15) = -4/3

Straight line AB has slope -4/3.
It's distance from origin is 12.

Now you have a CLEAR way to determine y-intercept = 20.
Figure it out, then you can apply your method to any similar problem.
OK?

6. Btw, there will always be 2 possible y-intercepts.

7. Originally Posted by Denis
Btw, there will always be 2 possible y-intercepts.
Corresponding to the negative y intercept of
C = $\pm\, d\, * \sqrt{s^2\, +\, 1}$
where s is the slope of the original line -s x + y + C = 0.

EDIT: Change dumb misteak of s to the proper -s in the equation for the line.

8. Originally Posted by Ishuda
Corresponding to the negative y intercept of
C = $\pm\, d\, * \sqrt{s^2\, +\, 1}$
where s is the slope of the original line s x + y + C = 0.
Agree. If slope negative, endpoints of distance line are in
1st and 3rd quadrants, if positive, then in 2nd and 4th.

The axes crossing points are:
(a,0), (0,b) and (-a,0), (0,-b) : slope negative
(b,0), (0,a) and (-b,0), (0,-a) : slope positive

...a symmetrical beauty

My professor suggested me a solution. He wrote it to me by mail, so I can't tell you how he derived it.
Given the couple <rho, theta>, where rho is the distance from origin and theta is the angle between the line and X axis, he told me to derive line's coefficents acconding to the following formulae:

a = cos(theta)
b = sin(theta)
c = -rho

Using this coefficients, I derived that line must certainly pass through points A(-c/a, 0) and B(0, -c/b).
I should handle cases when a or b are equal to zero, but at the moment I'm just performing a test.

Do you think all this makes sense?

10. Originally Posted by Ishuda
Corresponding to the negative y intercept of
C = $\pm\, d\, * \sqrt{s^2\, +\, 1}$
where s is the slope of the original line -s x + y + C = 0.

EDIT: Change dumb misteak of s to the proper -s in the equation for the line.
I divided the expression under the root operator by $B^2$ and I got $B\sqrt{s^2+1}$. What happened to $B^2$ in your calculations?