# Calculate the angle of a line given a point (x,y) and a slope [closed]

Given a point (x,y) and a slope (m), how can I calculate the angle from the x axis.

I can calculate the x intercept (x',0) to get a line from the x axis, but I don't know if I am on the right track.

In the case of a negative slope I suspect that the angle will be greater than 90 degree. Is that correct?

• Do you know any trig functions? Slope = $\frac {\triangle y}{\triangle x}$. Does that remind you of any trig function? Feb 15, 2017 at 9:23
• @Simon Goodman In case of a negative slope, then the angle is greater that 90 degree but less than 180 degree. Feb 15, 2017 at 9:42
• Don’t get discouraged by the downvotes. I don’t see any particularly good reason for them.
– amd
Feb 15, 2017 at 9:46
• Don't worry about downvotes. That just means people are jerks. It was a legitimate question and n-one is born knowing this stuff. And it's a very good question. I will explain the answer in a moment. Feb 15, 2017 at 16:45
• " put on hold as off-topic by TheGeekGreek, user91500, Claude Leibovici, Daniel W. Farlow, Zachary Selk 1 hour ago This question appears to be off-topic. The users who voted to close gave this specific reason: "This question is missing context or other details:" Are you F###ing KIDDING me????? This was a perfect and clear and concise question. And it included thought and work. Utterly no reason to close. Seriously, closing it is a real jerky move. Feb 15, 2017 at 20:07

Hint: Slope of a line is $\tan(\theta)$, where $\theta$ is the angle measured from positive $x$-axis. So $m=\tan(\theta)$.

• Thanks, I didn't know that m=tan(angle). So the angle = atan(m)? Feb 15, 2017 at 9:45
• Yes. You can derive that the slope is the tangent of the angle made by that line wrt x-axis by observing the definitions of $\tan(\theta)$ and the slope of a line. Feb 15, 2017 at 10:01
• This follows directly from the definitions of the trigonometric functions. However if one doesn't know the trig functions there is utterly no reason to assume a person will come up with them on their own. Feb 15, 2017 at 20:12
• @fleablood Thank you for making a point there. And I appreciate that you have written an answer for introducing trigonometry. Feb 15, 2017 at 20:53

Crash course in trigonometry to solve this:

The slope of line is the proportion of change in the rise ($y$ value) in relation to the change in the run ($x$ values) so given any two points in the line, $P = (x_p, y_p)$ and $Q = (x_q, y_q)$ the slope is going to be a constant value $m = \frac {\triangle y}{\triangle x} = \frac{y_p - y_q}{x_p = y_q}$.

Now you ask what is the angle formed by the line and the $x$-axis.

Imaging a right triangular wedge. The base is some run along the $x$ axis. It has some length we'll call $a = \delta x$ and the altitude is some rise along the $y$ axis. It has some length we'll call it $b = \delta y$ and then there is the hypotenuse with length $h = \sqrt{\delta x^2 + \delta y^2}$ (but that's not important).

The hypotenuse has a slope of $m = \frac {\delta y}{\delta x}$ and there is some angle, let's call it $\theta$, and it's pretty clear there is a relationship between $\theta$ and the slope but it isn't clear what exactly it is.

Okay... so lets step back. All triangles with the the same angles are proportional. If you make one side longer but keep the angles the same you make all side proportionally long. So any right triangle with angle $\theta$ will always have a hypotenuse with slope $m$. If the triangle is has sides $A, B, H$ and $A = a*k$ for some value $k$ then $A=a*k$ and $B= a*k$ and $H = h *k$ and $A/B = a*k/b*k = a/b = \delta y /\delta x = m$ and $A/H = ak/hk = a/h= \frac {\delta y}{\sqrt{\delta y^2 + \delta x^2}}$ and $B/H = bk/hk = b/h= \frac {\delta x}{\sqrt{\delta y^2 + \delta x^2}}$

This proportions are true for all right triangles with angle $\theta$.

And that is what Trigonometry is. Trigonometry is the study of these values in relation to the angles.

Trigonomety definitions:

we are given that there is an angle $\theta$, we imagine a right triangle with that angle. We imagine that the right triangle has three sides that we call: hypotenuse (you know what that is; because we are taking proportions and not "stand alone" values we may as well assume this is of length $1$), opposite (this is the side that is opposite the angle; it is the $y$ value), and adjacent (this is the side that is "next to" the angle; it is the $x$ value).

Now we define the following terms for proportions that are distinct for this particular angle $\theta$.

Sine: $\sin \theta = \frac {\text{**opposite**}}{\text {**hypotenuse**}}$; the is the proportion of the rise, $y$ value, in terms of hypotenuse.

Cosine: $\cos \theta = \frac {\text{**adjecent**}}{\text {**hypotenuse**}}$; the is the proportion of the rise, $x$ value, in terms of hypotenuse.

Tangent: $\tan \theta = \frac {\text{**oposite**}}{\text {**adjecent**}}= \frac {\sin \theta}{\cos \theta}=$ slope of hypotenuse.

So for example let's say you had a right triangle with a base angle of $47$ and a hypotenuse of $6$. And we took a yard stick and measured the other two sides. As it turns out we'd find that the base side would be $\approx 4.092$, the altitude side would be $\approx 4.388$ and the slope of the hypotenuse would be $\approx \frac {4.388}{4.092} = 1.072$. This would be proportional for all right triangles with base angle $47$.

So we say:

$\sin 47 = \frac{4.388}{6} = 0.682$

$\cos 47 = \frac{4.092}{6} = 0.731$

$\tan 47 = {4.388}{4.092} = 1.072$

Another example suppose we hat a triangle and with sides $3,4,5$ (the most famous right triangle). And imaging we took a compass and measured the base angle and it so happened that that angle was $53.13$.

So $\sin 53.13 = .8$

$\cos 53.13 = .6$

$\tan 53.13 = 1.3333333....$.

So how do you figure out the $angle$ from the proportions or vice-versa?

Short answer: you don't. There are some special tricks for some angles (a $45$ degree angle means it's an isoceles triangle and we can use the pythogorean theorem to conclude $\sin 45 = \cos 45 = \sqrt{\frac 12}$ etc.) but there is no "algebraic" calculations to convert slope to angles.

But there are trig table and buttons on calculators. Take an angle $\theta$ and punch it into the calculator to find $\tan \theta = m$ and ... that's the slope.

Okay... that tells us how to find angle $\implies$ slope. How do we do slope $\implies$ angle? Well that's call the inverse function or Arctangent. The "arc functions" are just the inverse functions that "go the other way"

$\sin \theta = y/h \iff \arcsin (y/h) = \sin^{-1} (y/h) = \theta$

$\cos \theta = x/h \iff \arccos (x/h) = \cos^{-1} (x/h) = \theta$

$\tan \theta = x/y \iff \arctan (x/y) = \tan^{-1} (x/y) = \theta$

So

Answer: If the slope of a line is $m$ then the angle is $\theta = \arctan m$.

If the angle of the line is $\theta$ then the slope is $m = \tan \theta = \frac {\sin \theta}{\cos \theta}$.

You just have to get used to a new set of vocabulary and functions.

• Brilliant answer, thanks a lot! Feb 15, 2017 at 18:56
• There is a typo on the 4th line where the symbol on the 2nd denominator should be minus, not equal. Apr 5, 2022 at 13:45