Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to write in java a function which finds the angles, in degrees, between 2 vectors, according to the follow equation - $$\cos{\theta} = \frac{\vec{u} \cdot \vec{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}$$

but in java the Math.acos method returns the angle radians, so what I have to do after I calculate $\frac{\vec{u} \cdot \vec{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}$, to get it in degrees?

share|cite|improve this question
Multiply the value in radians by $\frac{360}{2\pi}$. You'll get the value in degrees. – Jonathan Y. Aug 10 '13 at 20:18
up vote 3 down vote accepted

You can compute the angle, in degrees, by computing the angle in radians, and then multiplying by

$\dfrac {360}{2\pi} = \dfrac {180\; \text{degrees}}{\pi\; \text{radians}}$:

$$\theta = \arccos\left(\frac{\vec{u} \cdot \vec{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}\right)\cdot \frac {180}{\pi}$$

share|cite|improve this answer
$\color{blue}{great~work}\color{green}{+}^\color{red}{+}\color{orange}{+}$ @amWhy – Software Aug 10 '13 at 23:46

After calculating the value in radians, simply multiply by $\frac {180}{\pi}$ to convert it into degrees.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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