Skip to content
Math

Direction of the Vector Calculator

Enter the components of your vector to find its direction angle, magnitude, direction cosines, and unit vector instantly. Works for both 2D and 3D vectors, shows the angle in degrees and radians, identifies the correct quadrant automatically, and walks through every step of the calculation.

Your details

Choose whether your vector has two or three components.
The horizontal component of the vector.
The vertical component of the vector.
Display the direction angle in degrees (0 to 360) or radians (0 to 2pi).
Direction angle
53.1301

Angle from the positive x-axis, measured counter-clockwise (degrees or radians).

Magnitude5
QuadrantQuadrant I
Unit vector x0.6
Unit vector y0.8
cos α (x-axis)0.6
cos β (y-axis)0.8
Angle with x-axis53.13
Angle with y-axis36.87
Unit x0.6
Unit y0.8
Unit z-

Direction angle: 53.13 degrees. Magnitude: 5.0000.

  • The vector lies in Quadrant I, so the direction angle is 53.13 degrees from the positive x-axis.
  • The magnitude (length) of this vector is 5.0000, and the unit vector has magnitude exactly 1.
  • Direction cosines cos(alpha) = 0.6000 and cos(beta) = 0.8000 equal the unit vector components.
  • The sum of squares of all direction cosines always equals 1, confirming the unit vector is correct.

Next stepPair the direction angle with the magnitude to fully describe the vector in polar form.

What is the direction of a vector?

A vector has two defining properties: magnitude (its length) and direction (the way it points). In two dimensions, direction is expressed as an angle measured counter-clockwise from the positive x-axis, ranging from 0 to 360 degrees (or 0 to 2pi radians). In three dimensions, a single angle is not enough, so direction is described by three direction cosines: the cosines of the angles the vector makes with the positive x-, y-, and z-axes respectively. Together, the direction cosines satisfy the identity cos^2(alpha) + cos^2(beta) + cos^2(gamma) = 1, which mirrors the fact that the unit vector always has magnitude 1.

How to find the direction angle of a 2D vector

Given a vector v = (x, y), the direction angle theta is computed using the four-quadrant arctangent function atan2(y, x), which automatically places the angle in the correct quadrant. If the raw result is negative, add 360 degrees to bring it into the standard [0, 360) range. For example, for v = (3, 4) the angle is atan2(4, 3) = 53.13 degrees, while for v = (-3, -4) the angle is atan2(-4, -3) = 233.13 degrees. The magnitude is sqrt(x^2 + y^2) and the unit vector is (x/|v|, y/|v|). You can also express the result in radians by multiplying degrees by pi/180.

Direction cosines and angles in 3D

For a 3D vector v = (x, y, z), the magnitude is |v| = sqrt(x^2 + y^2 + z^2). The direction cosines are cos(alpha) = x/|v|, cos(beta) = y/|v|, and cos(gamma) = z/|v|, where alpha, beta, and gamma are the angles with the positive x-, y-, and z-axes. These are identical to the components of the unit vector. To recover the angles in degrees, apply arccos to each cosine. A useful sanity check: the sum of the squares of all three direction cosines must equal exactly 1. For a vector pointing along the x-axis, cos(alpha) = 1, cos(beta) = 0, cos(gamma) = 0, and alpha = 0, beta = 90, gamma = 90 degrees.

The unit vector and why it matters

The unit vector in the direction of v is simply v divided by its magnitude: u = v / |v|. Its length is always exactly 1, so it captures only the direction and discards the scale. Unit vectors are fundamental throughout physics and engineering: force direction, surface normals in 3D graphics, gradient directions in calculus, and basis vectors in linear algebra are all expressed as unit vectors. The direction cosines are mathematically identical to the components of the unit vector, which is why their squares always sum to 1.

Quadrant reference for 2D vectors

xyQuadrantAngle range
> 0> 0Quadrant I0 to 90 deg
< 0> 0Quadrant II90 to 180 deg
< 0< 0Quadrant III180 to 270 deg
> 0< 0Quadrant IV270 to 360 deg
> 0= 0Positive x-axis0 deg
= 0> 0Positive y-axis90 deg
< 0= 0Negative x-axis180 deg
= 0< 0Negative y-axis270 deg

Standard rules for determining direction angle based on vector components.

Frequently asked questions

What is the formula for the direction of a vector?

For a 2D vector v = (x, y), the direction angle is theta = atan2(y, x), adjusted to [0, 360) degrees if negative. For a 3D vector v = (x, y, z), direction is described by three direction cosines: cos(alpha) = x/|v|, cos(beta) = y/|v|, cos(gamma) = z/|v|, where |v| = sqrt(x^2 + y^2 + z^2) is the magnitude.

Why do I use atan2 instead of arctan?

The ordinary arctan function returns values in (-90, 90) degrees and cannot distinguish between vectors in opposite quadrants, for example (1, 1) and (-1, -1) give the same arctan(y/x) = 45 degrees even though their directions are opposite. The atan2(y, x) function takes both components as separate arguments and uses their signs to place the angle in the correct quadrant, returning values in (-180, 180] degrees.

What are direction cosines?

Direction cosines are the cosines of the angles a vector makes with each coordinate axis. For a 3D vector v = (x, y, z) with magnitude |v|, they are cos(alpha) = x/|v|, cos(beta) = y/|v|, and cos(gamma) = z/|v|. They are identical to the components of the unit vector, and they always satisfy cos^2(alpha) + cos^2(beta) + cos^2(gamma) = 1.

How do I find the direction of a vector from two points?

Subtract the starting point coordinates from the ending point coordinates to get the component vector. For example, from point A = (1, 2) to point B = (4, 6), the vector is v = (4-1, 6-2) = (3, 4). Then apply the direction angle formula: atan2(4, 3) gives about 53.13 degrees.

Can the direction angle be greater than 360 degrees?

No. The standard direction angle is always in the range [0, 360) degrees or [0, 2pi) radians. Angles outside that range simply mean a full revolution has been added or removed. This calculator always returns a value in that standard range using atan2 and adding 360 when needed.

What is the difference between direction and magnitude of a vector?

Magnitude is the length of the vector, computed as the square root of the sum of squared components. Direction is the angle or set of angles that describe which way the vector points, independent of how long it is. Two vectors with the same direction but different magnitudes are parallel scalar multiples of each other.

Sources

Written by Dr. Rajiv Menon, PhD Applied Mathematician · Bengaluru, India

Applied mathematician bridging algebraic theory and computational tools for students, engineers, and everyday problem-solvers.

Search 3,500+ calculators

Loading search…