I want to find the Q angle that creating with Y axis in degrees using vectors

enter image description here

  • $\begingroup$ Let me see if I understand the question. You have two points $(x_1, y_1)$ and $(x_2, y_2)$, and you want to know the angle between the $y$-axis and the line they determine. Is that right? (And there is some requirement to "use vectors" in some way?) $\endgroup$ – Jason Zimba Mar 16 '14 at 16:42
  • $\begingroup$ yes that's what i want $\endgroup$ – JanithOCoder Mar 16 '14 at 17:09
  • $\begingroup$ OK. I added vectorial aspect to my answer below. $\endgroup$ – Jason Zimba Mar 16 '14 at 17:17
  • 1
    $\begingroup$ Note, perhaps based on your screen name, I was thinking about computer code here. I went with $\cos^{-1}$ rather than $\tan^{-1}$ so that you would never throw an error due to a vanishing denominator. $\endgroup$ – Jason Zimba Mar 16 '14 at 17:17

Assume the two points are distinct, otherwise the problem is ill-posed.

Let $Y_1 = {\rm max}(y_1, y_2)$ and $Y_2 = {\rm min}(y_1, y_2)$. Then the angle between the line and the $y$-axis is $$\cos^{-1}\!\left({Y_1 - Y_2\over\sqrt{(x_1-x_2)^2 +(Y_1-Y_2)^2} }\right)\,.$$

If there is some requirement to use vectors, then the above expression can be derived vectorially as follows. Letting ${\bf r}_1 = (x_1, Y_1)$ and ${\bf r}_2 = (x_2, Y_2)$, define the unit vector $\hat{\bf r} = ({\bf r}_1 - {\bf r}_2)/||{\bf r}_1-{\bf r}_2||$. The unit vector $\hat{\bf y}$ defining the direction of the $y$-axis is $\hat{\bf y} = (0, 1)$. Now using the dot product, $\cos\theta = \hat{\bf y}\cdot \hat{\bf r}$. Working with components leads to the explicit expression above.


I don't know how to do with vectors. A simple way is to use $$\tan(90-\theta)=\dfrac{y_2-y_1}{x_2-x_1}$$
Take the solution of the above equation s.t. $\theta<\pi/2.$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.