Introduction to vectors
Before moving on to the core topic, we would like to build a foundation for getting there. Hence, this segment of the chapter is very important. It might look familiar to you and many of you will be cognizant about this. However, going through this channel will set the flow.
A vector is an object that has both a direction and magnitude. It is represented by an arrow and with a coordinate (x, y) in space, as shown in the following plot:
![](https://static.packt-cdn.com/products/9781788830577/graphics/c6bb03b5-930c-4b35-b259-6c05053cfaa7.png)
As shown in the preceding diagram, the vector OA has the coordinates (4,3):
Vector OA= (4,3)
However, it is not sufficient to define a vector just by coordinates—we also need a direction. That means the direction from the x axis.
Magnitude of the vector
The magnitude of the vector is also called the norm. It is represented by ||OA||:
![](https://static.packt-cdn.com/products/9781788830577/graphics/30e0fc8f-4d95-4b6d-8ab1-c48685444fe9.png)
To find out magnitude of this vector, we can follow the Pythagorean theorem:
OA2 = OB2 + AB2
= 42 + 32
= 16 + 9
= 25
Hence:
OA = √25 = 5
||OA||= 5
So, if there is a vector x = (x1,x2,....,xn):
||x||= x12 + x22+........