KEDonaldson
Mathematics

Linear Algebra - Introduction to Vectors

Kyle Edward Donaldson
#linear algebra#vectors#vector notation#vector magnitude#vector direction#introduction to vectors#math concepts#Khan Academy#geometry#mathematics#physics#engineering#computer science#educational blog#learning linear algebra#vector examples

Introduction to Vectors

Real world uses of vectors

Vectors make up so much of our daily lives often without us even realising. One way you may have used vectors is in a physics class, where it’s referred to as velocity. And what is velocity? Well, it’s a way of describing speed and direction. And that’s the single, simple key to understanding vectors.

So what’s the difference between velocity and a vector?

And what are some other real world uses?

Physics:
Engineering:
Computer Graphics & Animation
Data Science & Machine Learning

This example shows a vector of (5, 4). It has both a direction in this 2D space example as well as a magnitude (distance). The magnitude is the length of the vector, and is worked out using Pythagoras’ theorem. The magnitude (a) is calculated by doing a = 52+42\sqrt{5^2 + 4^2}. Essentially you’re getting the squared area of each plotted point and then the root of them combined to get the non-squared length from the origin to the destination.

You could have a feature vector of (5, 4) but the 5 could represent the number of rooms of a house, and the 4 could represent the age. So your feature vector for this specific example would be f = (5, 4). If your data set had many houses, you could represent each house with this feature vector and your machine learning model could use these vectors to learn patterns and make predictions.

Astronomy & Space Exploration

Recapping what is a vector?

A vector is a mathematical object that has both magnitude (size) and direction. They’re often visually represented as arrows, where the length is the magnitude and the direction of the arrow is the direction. In algebra, they’re typically represented as ordered lists of numbers (coordinates), such as in 2D space v=(x,y)\vec{v} = (x, y) and in 3D space v=(x,y,z)\vec{v} = (x, y, z).

A vector in the machine learning world (a feature vector) utilises the vector shape of being an ordered list of numbers but those numbers/features could represent things other than magnitude and direction.

Key Concepts in Vectors

What’s a scalar and how does it differ to a vector?

A scalar is a quantity that has only magnitude and no direction. Examples of scalars include temperature, mass, time, speed, etc.

You could use a scalar as part of your vector, such as the speed part of velocity.

What is a Unit Vector?

A unit vector is a vector that has a magnitude of exactly 1 unit and points in a specific direction. It is used to indicate direction without concern for magnitude. Unit vectors are often used as the building blocks for more complex vectors, allowing any vector to be expressed as a combination of unit vectors scaled by the vector’s components.

Properties of Unit Vectors:
Example:

In 2D space:

In 3D space:

Normalizing a Vector:

Any vector can be converted into a unit vector (a process called “normalization”) by dividing the vector by its magnitude. For a vector v=(x,y,z)\vec{v} = (x, y, z), the unit vector v^\hat{v} is calculated as: v^=vv=(xv,yv,zv)\hat{v} = \frac{\vec{v}}{\|\vec{v}\|} = \left(\frac{x}{\|\vec{v}\|}, \frac{y}{\|\vec{v}\|}, \frac{z}{\|\vec{v}\|}\right) where v\|\vec{v}\| is the magnitude of the vector.

Unit vectors are essential in many areas of physics, engineering, and computer graphics, as they allow for the representation of direction independently of magnitude.

How are vectors represented?

A vector could be represented in several different ways, depending on the context:

Vector Addition and Subtraction

Addition

Vector addition involves combining two or more vectors to produce a resultant vector. The process is performed component-wise, meaning you add the corresponding components (x with x, y with y, etc.) of the vectors.

You can visualise vector addition as being “tip-to-tail”. The origin (or tail) of the second vector starts on the tip of the first vector. The resultant vector is drawn from the tip of the first to the tip of the last.

For example, if v=(32)\vec{v} = \begin{pmatrix} 3 \\ 2 \end{pmatrix} and w=(14)\vec{w} = \begin{pmatrix} 1 \\ 4 \end{pmatrix}, then:

v+w=(3+12+4)=(46)\vec{v} + \vec{w} = \begin{pmatrix} 3 + 1 \\ 2 + 4 \end{pmatrix} = \begin{pmatrix} 4 \\ 6 \end{pmatrix}

This resulting vector v+w\vec{v} + \vec{w} has a component of 4 along the x-axis and 6 along the y-axis.

Subtraction

Vector subtraction is similar to addition but involves reversing the direction of the vector being subtracted before adding it. The result is the vector that “connects” the end of the vector being subtracted to the start of the other vector.

For example, if v=(57)\vec{v} = \begin{pmatrix} 5 \\ 7 \end{pmatrix} and w=(23)\vec{w} = \begin{pmatrix} 2 \\ 3 \end{pmatrix}, then:

vw=(5273)=(34)\vec{v} - \vec{w} = \begin{pmatrix} 5 - 2 \\ 7 - 3 \end{pmatrix} = \begin{pmatrix} 3 \\ 4 \end{pmatrix}

This resulting vector vw\vec{v} - \vec{w} has a component of 3 along the x-axis and 4 along the y-axis.

Mathematical Operations with Vectors

Dot Product

The dot product (or scalar product) is a mathematical operation that takes two vectors and returns a scalar (a single number). The dot product is calculated by multiplying corresponding components of the vectors and then summing these products. It is often used to determine the angle between two vectors or to find projections of one vector onto another.

Cross Product

Summary: The cross product (or vector product) is an operation on two vectors in three-dimensional space that results in a new vector perpendicular to both original vectors. The magnitude of the cross product is proportional to the area of the parallelogram formed by the two vectors, and its direction is given by the right-hand rule.

Tips:

Vector Scaling

Summary: Vector scaling involves multiplying a vector by a scalar, which changes the magnitude of the vector but not its direction (unless the scalar is negative, which also reverses the direction). This operation is fundamental for resizing vectors, adjusting their magnitude according to a scalar quantity.

Tips:

Similar Posts

Arrows of varying lengths and directions

Linear Algebra - Introduction to Determinants & Inverses

Arrows of varying lengths and directions

Linear Algebra - Introduction to Vector Spaces & Basis

← Back to Blog