**Orthogonal Vectors:** Two vectors are orthogonal to each other when their dot product is 0.

**How do we define the dot product?**

Dot product(scalar product) of two n-dimensional vectors A and B, is given by this expression.

Thus the vectors A and B are orthogonal to each other if and only if

Note: In a compact form the above expression can be wriiten as **(A^T)B**.

**Example: **

Consider the vectors v1 and v2 in 3D space.

Taking the dot product of the vectors.

Hence the vectors are orthogonal to each other.

**Code: Python program to illustrate 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) ` ` ` `# This code is contributed by Amiya Rout ` |

*chevron_right*

*filter_none*

**Output:**

Result = [[0]]

**Unit Vector:**

Let’s consider a vector A. The unit vector of the vector A may be defined as

Let’s understand this by taking an example. Consider a vector A in 2D space.

The magnitude of A is given by

So the unit vector of A can be calculated as

**Properties of unit vector:**

- Unit vectors are used to define directions in a coordinate system.
- Any vectors can be written as a product of a unit vector and a scalar magnitude.

**Orthonormal vectors: **

These are the vectors with unit magnitude. Now, take the same 2 vectors which are orthogonal to each other and you know that when I take a dot product between these 2 vectors it is going to 0. So If we also impose the condition that we want each of these vectors to have unit magnitude then what we could possibly do is by taking this vector and then divide this vector by the magnitude of this vector as we see in unit vector. Now we can write v1 and v2 as

So what we do is we have taken the vectors from the previous example and converted them into unit vectors by dividing them with their magnitudes. **So, these vectors will still be orthogonal to each other and now individually they also have unit magnitude. Such vectors are known as orthonormal vectors.**

**Note:** All orthonormal vectors are orthogonal by the definition itself.

Attention geek! Strengthen your foundations with the **Python Programming Foundation** Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the **Python DS** Course.

## Recommended Posts:

- Basis Vectors in Linear Algebra - ML
- Components of Linear Algebra
- Calculate inner, outer, and cross products of matrices and vectors using NumPy
- Mathematics | Eigen Values and Eigen Vectors
- Python | Implementing 3D Vectors using dunder methods
- How to calculate dot product of two vectors in Python?
- Compute the outer product of two given vectors using NumPy in Python
- Compute the inner product of vectors for 1-D arrays using NumPy in Python
- Compute the inner product of vectors for 1-D arrays using NumPy in Python
- How to compute the cross product of two given vectors using NumPy?
- PyQtGraph – Getting Pixel Vectors of Bar Graph
- Properties of Boolean Algebra
- Proof of De-Morgan's laws in boolean algebra
- Linear Regression (Python Implementation)
- Mathematics | L U Decomposition of a System of Linear Equations
- Mathematics | System of Linear Equations
- Linear Regression using PyTorch
- Creating linear kernel SVM in Python
- Linear Regression Using Tensorflow
- ML | Linear Regression

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.