MathAlgebraLinear algebraVectors and vector spaces

Vector operations

5 minutes read

You already have an understanding of the notion of vectors and why they are very useful. But sometimes we need to perform some operations on them. Imagine we have real numbers that indicate the distance between cities. But we are not interested in knowing just that, we want to calculate, for example, the shortest route. To do that, we will need arithmetic operations. Same with vectors: they are interesting when we can use them for something practical. Usually, we get new vectors after applying vector operations. This fact is crucial not only for fundamental areas of mathematics like linear algebra or calculus but also for modern areas of computer science like machine learning, video game development, and graphic design!

Vector operations

Like real numbers, vectors have main operations such as addition and multiplication, with subtraction and division as their respective inverses. Let's delve into these vector operations in detail.

Addition

In order to add two vectors, you first need to make sure they have an "equal size", that is, the number of elements. Remember, if vectors are of different sizes, they cannot be added together. So, to add two vectors, you just need to sum their respective elements. For example: assuming we have two equal-sized vectors aa and bb.

a=(2,3,5),b=(1,0,2)\vec{a}=(2,3,-5), \vec{b}=(-1,0,2)

Now, add them together and you get the new vector cc:

c=a+b=(2,3,5)+(1,0,2)==(2+(1),3+0,5+2)=(1,3,3)\\ \vec{c}=\textcolor{blue}{\vec{a}} + \textcolor{red}{\vec{b}} = (\textcolor{blue}{2,3,-5}) + (\textcolor{red}{-1,0,2})=\\=(\textcolor{blue}{2}+\textcolor{red}{(-1)},\textcolor{blue}{3}+\textcolor{red}{0},\textcolor{blue}{-5}+\textcolor{red}{2})=(1,3,-3)

As you can see, it's all quite simple! And just like addition, subtraction of vectors goes the same way, since subtraction is just the addition with the minus sign.

Multiplication by a scalar

This operation is even simpler. To multiply a vector by a scalar, just multiply every vector element by that value. Let's take a vector a=(7,2,0,4,1)\vec{a}=(7,2,0,4,1) and multiply it by a scalar λ=2\lambda=2:

c=λa=2(7,2,0,4,1)=(14,4,0,8,2)\vec{c}=\lambda \cdot \vec{a}=2 \cdot (7,2,0,4,1)=(14,4,0,8,2)

Pay attention to interesting special cases of multiplication by a scalar:

  • If you multiply any vector by 00, it will turn into a null vector:

0a=(07,02,00,04,01)=(0,0,0,0,0)0 \cdot \vec{a} = (0 \cdot 7, 0 \cdot 2, 0 \cdot 0, 0 \cdot 4, 0 \cdot 1) = (0, 0, 0 ,0 ,0)

  • If you multiply a null vector by any scalar, it will remain a null vector:

5(0,0,0)=(50,50,50)=(0,0,0)5 \cdot (0 ,0, 0) = (5 \cdot 0, 5 \cdot 0, 5 \cdot 0) = (0, 0, 0)

You might want to ask where is vector multiplication? Don't worry, it does exist, but it will be discussed later.

Combining vector operations

Those operations follow the same pattern as operations for numbers, that we are so used to. For instance, let's say you have three vectors

a=(4,5,1),b=(3,3,33),c=(7,8,13)\vec{a}=(4,-5,-1), \vec{b}=(3,3,33), \\ \vec{c}=(-7,8,-13)You want to calculate the following:

3a+2b+4c3a+2b+4c.

Well then, let's do it:

3a+2b+4c==3(451)+2(3333)+4(7813)==(12153)+(6666)+(283252)==(12+62815+6+323+6652)==(102311)3\textcolor{blue}{\vec{a}}+2\textcolor{red}{\vec{b}}+4\textcolor{green}{\vec{c}}=\\=3\cdot\textcolor{blue}{\begin{pmatrix}4\\-5\\-1\end{pmatrix}} + 2 \cdot \textcolor{red}{\begin{pmatrix}3\\3\\33\end{pmatrix}}+4 \cdot\textcolor{green}{\begin{pmatrix}-7\\8\\-13\end{pmatrix}}=\\=\textcolor{blue}{\begin{pmatrix}12\\-15\\-3\end{pmatrix}}+\textcolor{red}{\begin{pmatrix}6\\6\\66\end{pmatrix}}+\textcolor{green}{\begin{pmatrix}-28\\32\\-52\end{pmatrix}}=\\=\begin{pmatrix}\textcolor{blue}{12}+\textcolor{red}{6}-\textcolor{green}{28}\\\textcolor{blue}{-15}+\textcolor{red}{6}+\textcolor{green}{32}\\\textcolor{blue}{-3}+\textcolor{red}{66}-\textcolor{green}{52}\end{pmatrix}=\\=\begin{pmatrix}-10\\23\\11\end{pmatrix}

Geometric interpretation of operations

Let's talk a little bit about the geometry behind vector operations.

Addition

As we've discussed, the result of adding two vectors a\vec{a} and be b\vec{b} is a vector. But how to draw this vector? Well, the triangle and parallelogram laws are here to help you!

The triangle law is usually used, if the first vector's a\vec{a} head joins the tail of the second vector b\vec{b}. The resultant vector a+b\vec{a}+\vec{b} connects the tail of a\vec{a} to the head of b\vec{b}.

The triangle law is also called the head-to-tail law, and it's much easier to memorize it under this name.

The parallelogram law is usually used if the tails of the vectors coincide. In this case, they form the two adjacent sides of a parallelogram. Since opposite sides of any parallelogram are parallel, you should draw a vector parallel to a\vec{a} whose tail joins the head of b\vec{b} and a vector parallel to b\vec{b} whose tail joins the head of a\vec{a} in order to complete this parallelogram. These vectors are shown as dashed lines in the picture. The result of the addition of a\vec{a} and b\vec{b} is the diagonal of our parallelogram through their common point!

The triangle and parallelogramm laws

Multiplication by a scalar

When a vector a\vec{a} is multiplied by a scalar λ\lambda, you also get a vector λa\lambda\vec{a}. This vector will have the same direction as a\vec{a} if λ\lambda is positive and the opposite direction of a\vec{a} if λ\lambda is negative. For instance, we have a=(2,1)\vec{a}=(2,1) that we want to multiply by the scalar 22 and by the scalar 12-\frac{1}{2}. As a result, we get 2a=(4,2)2\vec{a}=(4, 2) and 12a=(1,12)-\frac{1}{2}\vec{a}=(-1, -\frac{1}{2}):

Multiplication by a scalar example

Properties of vector operations

As far as properties resulting from the discussed operations are concerned, let's point out the three main ones.

Commutativity of addition. This one is simple: it doesn't matter in what order to add vectors. That means a+b=b+a\vec{a}+\vec{b}=\vec{b}+\vec{a}. It's easy to check too: we add the corresponding coordinates as numbers and don't care in what order we do that operation.

Associativity of addition. The property is related to the order of parentheses. The main idea is that during the addition of more than 22 vectors, it's not important how parentheses are arranged, that is a+(b+c)=(a+b)+c\vec{a}+(\vec{b}+\vec{c})=(\vec{a}+\vec{b})+\vec{c}. It is also easy to check if you just calculate the expression. You can also easily prove it using the triangle law. At first, focus on the left side of the statement. When you add c\vec{c} to b\vec{b} using the triangle law, you get the yellow vector b+c\vec{b}+\vec{c}. After that, apply the triangle law once more to add this vector to a\vec{a} and you'll get the black vector a+(b+c)\vec{a} + (\vec{b} + \vec{c}). Nearly the same thing is done according to the right side of the statement. You add b\vec{b} to a\vec{a} and get the yellow vector a+b\vec{a}+\vec{b} and afterward, you add c\vec{c} to this vector. Once again, you get the black vector a+b+c\vec{a}+\vec{b}+\vec{c} !

Proof of associativity of addition

Distributivity of scalar multiplication over addition. The property shows us the rule for opening the parentheses during scalar multiplication. The rule goes as follows: λ(a+b)=λa+λb\lambda \cdot (\vec{a}+\vec{b})=\lambda \vec{a}+\lambda \vec{b}. To verify it, you only need to calculate values on both ends of the equation and see that they are the exact same ones. Here's also a geometric proof of this property:

Proof of Distributivity of scalar multiplication over addition

Conclusion

You learned how to add vectors and how to multiply them by a scalar. Most other operations are built around the first two in some way. You also learned about their importance, since without them, it wouldn't really be possible to do anything but look at the vectors. And now it's time to test how well you understood the topic and exercise a bit.

19 learners liked this piece of theory. 0 didn't like it. What about you?
Report a typo