What is a Vector?
A vector is a quantity that has both magnitude (size) and direction. Velocity, force, displacement, and acceleration are all vectors. Scalars like temperature or mass have only magnitude. Understanding vectors is essential for physics, engineering, computer graphics, and machine learning.
In this lesson
1 Vectors vs Scalars
A scalar has only a number , temperature is 72°F, mass is 5 kg, time is 3 hours. A vector has a number and a direction , velocity is 60 mph north, force is 10 N upward, displacement is 5 km east.
The same magnitude with a different direction is a completely different vector. Wind blowing north at 30 mph and wind blowing south at 30 mph have the same speed (scalar) but opposite velocities (vectors). This distinction is critical in physics.
Vectors are drawn as arrows. The length of the arrow represents the magnitude; the direction the arrow points represents the direction. In print, vectors are often written in bold (v) or with an arrow (→v).
2 Vector Notation and Components
A 2D vector can be described by its components: how far it goes in the x-direction and y-direction. The vector from point A(1, 2) to point B(4, 6) has components (4−1, 6−2) = (3, 4).
Written as ⟨3, 4⟩ or [3, 4] or 3î + 4ĵ (where î and ĵ are unit vectors along x and y axes).
3 Vector Addition and Scalar Multiplication
Addition: add corresponding components. ⟨a, b⟩ + ⟨c, d⟩ = ⟨a+c, b+d⟩. Geometrically: place the second vector's tail at the first vector's head.
Scalar multiplication: multiply each component by the scalar. k⟨a, b⟩ = ⟨ka, kb⟩. This scales the magnitude by |k| and reverses direction if k is negative.
4 Magnitude and Unit Vectors
The magnitude (length) of vector ⟨a, b⟩ is |v| = √(a² + b²) , the Pythagorean theorem applied to the components.
A unit vector has magnitude 1 and points in the same direction: û = v/|v|. Unit vectors describe pure direction without magnitude.
5 The Dot Product
The dot product of two vectors: u · v = u₁v₁ + u₂v₂. It produces a scalar, not a vector.
Geometric meaning: u · v = |u||v|cos θ, where θ is the angle between them. This means: if two vectors are perpendicular, their dot product is 0 (cos 90° = 0). If they point in the same direction, the dot product equals the product of their magnitudes.
⟨3, 4⟩ · ⟨4, −3⟩ = 12 − 12 = 0. Yes , dot product of zero means they are perpendicular (orthogonal). This is how you test for right angles between vectors.
6 Real-World Applications
Physics: force, velocity, and acceleration are vectors. Adding force vectors determines the net force on an object (Newton's laws). Projectile motion decomposes velocity into horizontal and vertical components , vector analysis.
Navigation: aircraft heading vectors account for wind vectors to determine actual ground track and speed. GPS systems compute position vectors and displacement vectors continuously.
Computer graphics: every object position, camera direction, and lighting calculation uses vectors. Normal vectors (perpendicular to surfaces) determine how light reflects. The dot product of the light direction and normal vector calculates how bright each pixel should be.
Machine learning: data points are vectors in high-dimensional space. Similarity between items is measured using cosine similarity , the dot product divided by the product of magnitudes. Recommendation systems work by finding vectors pointing in similar directions.
Practice Problems
Sources & Further Reading
The explanations on this page draw on the following established sources. We link to primary and secondary sources so you can verify claims and go deeper on any topic.