This content originally appeared on DEV Community and was authored by Shlok Kumar
In linear algebra, understanding orthogonal and orthonormal vectors is crucial, especially for applications in machine learning. This blog post will simplify these concepts without delving too deeply into complex mathematics.
Orthogonal Vectors
Two vectors are considered orthogonal if their dot product equals zero. But what exactly is the dot product? The dot product (or scalar product) of two n-dimensional vectors, A and B, can be expressed as follows:
A · B = ∑ (from i=1 to n) a_i * b_i
Thus, vectors A and B are orthogonal if:
A · B = 0
Example
Consider two vectors in 3D space:
- ( v_1 = [1, -2, 4] )
- ( v_2 = [2, 5, 2] )
To check if they are orthogonal, we calculate their dot product:
v_1 · v_2 = [1, -2, 4] · [2, 5, 2] = 1*2 + (-2)*5 + 4*2 = 0
Since the result is zero, the vectors are orthogonal.
Python Code Example
Here's a simple Python program that illustrates orthogonal vectors:
# A python program to illustrate orthogonal vector
# Import numpy module
import numpy
# Taking two vectors
v1 = [[1, -2, 4]]
v2 = [[2, 5, 2]]
# Transpose of v1
transposeOfV1 = numpy.transpose(v1)
# Matrix multiplication of both vectors
result = numpy.dot(v2, transposeOfV1)
print("Result =", result)
# Output
# Result = 0
Unit Vectors
Next, let's discuss unit vectors. A unit vector is derived from a vector by dividing it by its magnitude. For a vector ( A ), the unit vector ( \hat{a} ) is defined as:
\hat{a} = A / |A|
Example
Consider a vector ( A ) in 2D space:
- ( A = [3, 4] )
The magnitude of ( A ) is calculated as follows:
|A| = √(3² + 4²) = 5
Thus, the unit vector ( \hat{a} ) is:
\hat{a} = A / |A| = [3/5, 4/5]
Properties of Unit Vectors
- Unit vectors define directions in a coordinate system.
- Any vector can be expressed as a product of a unit vector and a scalar magnitude.
Orthonormal Vectors
Orthonormal vectors are not only orthogonal but also have unit magnitude. To convert orthogonal vectors into orthonormal vectors, simply divide each vector by its magnitude.
For the vectors we considered earlier:
- For ( v_1 = [1, -2, 4] ):
v_1' = v_1 / |v_1| = [1, -2, 4] / √(1² + (-2)² + 4²)
- For ( v_2 = [2, 5, 2] ):
v_2' = v_2 / |v_2| = [2, 5, 2] / √(2² + 5² + 2²)
By converting these vectors into unit vectors, they remain orthogonal and achieve unit magnitude, hence forming orthonormal vectors.
Note
All orthonormal vectors are inherently orthogonal, as defined by their properties.
For more content, follow me at - https://linktr.ee/shlokkumar2303
This content originally appeared on DEV Community and was authored by Shlok Kumar

Shlok Kumar | Sciencx (2025-02-14T16:30:00+00:00) Orthogonal and Orthonormal Vectors in Linear Algebra. Retrieved from https://www.scien.cx/2025/02/14/orthogonal-and-orthonormal-vectors-in-linear-algebra/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.