Vector Calculator – Magnitude, Direction & Angle in Coordinate Plane
A 2D vector can represent a displacement, velocity, force, or any quantity with both magnitude and direction.
In the coordinate plane, a vector is commonly written as
\(\vec v=\langle v_x,\;v_y\rangle\), where \(v_x\) and \(v_y\) are its horizontal and vertical components.
1) Vector from two points
If a vector goes from point \(A(x_1,y_1)\) to point \(B(x_2,y_2)\), then the components are
\[
\vec v = \overrightarrow{AB}
= \langle x_2-x_1,\;y_2-y_1\rangle.
\]
Example: From \((1,2)\) to \((5,5)\),
\(\vec v=\langle 5-1,\;5-2\rangle=\langle 4,\;3\rangle\).
2) Magnitude (length)
The magnitude (also called the norm) is found with the Pythagorean theorem:
\[
|\vec v|=\sqrt{v_x^2+v_y^2}.
\]
For \(\langle 4,3\rangle\), \(|\vec v|=\sqrt{4^2+3^2}=5\).
3) Direction angle
The direction angle \(\theta\) is measured counterclockwise from the positive \(x\)-axis.
The most robust formula uses the two-argument arctangent:
\[
\theta=\operatorname{atan2}(v_y,\;v_x).
\]
Many calculators also report the “standard position” angle in \([0,2\pi)\) (or \([0^\circ,360^\circ)\)),
which is just \(\theta\) wrapped into that interval.
In degrees:
\[
\theta^\circ = \theta\cdot\frac{180}{\pi}.
\]
4) Unit vector (direction only)
If \(\vec v\neq \vec 0\), the unit vector in the same direction is
\[
\hat v=\frac{\vec v}{|\vec v|}
=\left\langle \frac{v_x}{|\vec v|},\;\frac{v_y}{|\vec v|}\right\rangle.
\]
The unit vector is not defined for the zero vector \(\vec 0=\langle 0,0\rangle\) because its magnitude is \(0\).
5) Components from magnitude + angle
If you know a magnitude \(r\ge 0\) and a direction angle \(\theta\), then
\[
v_x=r\cos\theta,\qquad
v_y=r\sin\theta.
\]
Common pitfalls
- Vertical direction: if \(v_x=0\), the slope \(v_y/v_x\) is undefined, but the angle is still valid (\(\theta=90^\circ\) or \(270^\circ\) depending on the sign of \(v_y\)).
- Quadrants: using \(\arctan(v_y/v_x)\) alone can lose quadrant information. That’s why \(\operatorname{atan2}(v_y,v_x)\) is preferred.
- Zero vector: \(|\vec v|=0\) and direction is not meaningful.
Graph note: the plot uses square units so distances and angles look correct (no stretched axes).