Components and length of a vector
A vector can be described either by its Cartesian components or by its magnitude together with one or more direction angles.
In 2D, the most common forms are \( \mathbf{v} = (v_x, v_y) \) and \( (|\mathbf{v}|,\theta) \). In 3D, a common description is
\( \mathbf{v} = (v_x, v_y, v_z) \) or \( (|\mathbf{v}|,\theta,\varphi) \), where \( \theta \) is the azimuth in the xy-plane and
\( \varphi \) is the elevation from the xy-plane.
Length in 2D and 3D
The length, also called the magnitude, comes from the Pythagorean theorem. In 2D it is the hypotenuse of a right triangle
built from the x- and y-components. In 3D the same idea extends by including the z-component.
2D magnitude.
\[
\begin{aligned}
|\mathbf{v}| &= \sqrt{v_x^2 + v_y^2}
\end{aligned}
\]
3D magnitude.
\[
\begin{aligned}
|\mathbf{v}| &= \sqrt{v_x^2 + v_y^2 + v_z^2}
\end{aligned}
\]
This is why the sample vector \( \langle 5,12 \rangle \) has length 13. Its components make the classic 5–12–13 triangle.
Sample 2D calculation.
\[
\begin{aligned}
|\mathbf{v}| &= \sqrt{5^2 + 12^2} \\
&= \sqrt{25 + 144} \\
&= \sqrt{169} \\
&= 13
\end{aligned}
\]
From magnitude and angles to components
When the vector magnitude and direction are known, the components are found with trigonometry. In 2D, the x-component uses
cosine and the y-component uses sine. In 3D, the elevation angle first tells you how much of the vector lies in the xy-plane,
and the azimuth then splits that horizontal part into x and y.
2D polar to Cartesian.
\[
\begin{aligned}
v_x &= |\mathbf{v}|\cos\theta \\
v_y &= |\mathbf{v}|\sin\theta
\end{aligned}
\]
3D magnitude and angles to components.
\[
\begin{aligned}
v_x &= |\mathbf{v}|\cos\varphi\cos\theta \\
v_y &= |\mathbf{v}|\cos\varphi\sin\theta \\
v_z &= |\mathbf{v}|\sin\varphi
\end{aligned}
\]
These formulas are often used in mechanics when a force must be resolved into rectangular components. A force of magnitude
\(F\) acting at angle \( \theta \) in 2D becomes \(F_x = F\cos\theta\) and \(F_y = F\sin\theta\), which is why this calculator
is also useful for quick force-resolution checks.
From components to direction angles
If the components are already known, then the direction can be reconstructed with inverse trigonometric functions. In 2D the
safest formula uses \( \operatorname{atan2}(v_y,v_x) \), because it places the angle in the correct quadrant automatically.
In 3D, the azimuth still comes from the horizontal projection, while the elevation is measured relative to the xy-plane.
2D direction angle.
\[
\begin{aligned}
\theta &= \operatorname{atan2}(v_y,\ v_x)
\end{aligned}
\]
3D azimuth and elevation.
\[
\begin{aligned}
\theta &= \operatorname{atan2}(v_y,\ v_x) \\
\varphi &= \operatorname{atan2}\!\left(v_z,\ \sqrt{v_x^2+v_y^2}\right)
\end{aligned}
\]
The direction is undefined for the zero vector because a vector of zero length does not point anywhere uniquely.
Unit vector and direction cosines
The unit vector keeps only the direction of the vector and rescales its length to 1. This is useful in geometry, physics,
and engineering because it separates “how much” from “which way.”
Unit vector.
\[
\begin{aligned}
\hat{\mathbf{v}} &= \frac{\mathbf{v}}{|\mathbf{v}|}
\end{aligned}
\]
In 3D, the component ratios of the unit vector are also called the direction cosines:
Direction cosines.
\[
\begin{aligned}
\ell &= \frac{v_x}{|\mathbf{v}|}, \\
m &= \frac{v_y}{|\mathbf{v}|}, \\
n &= \frac{v_z}{|\mathbf{v}|}
\end{aligned}
\]
Identity for direction cosines.
\[
\begin{aligned}
\ell^2 + m^2 + n^2 &= 1
\end{aligned}
\]
So this calculator is not only a magnitude tool. It connects the geometric picture of a vector to its algebraic form,
helps convert between coordinate systems, and provides a quick visual check with dashed component lines and a vector arrow.