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

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?

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