28 julio, 2024

Base change in vector spaces

Do you know what a base change is and how to do it in vector spaces? A vector space is nothing more than a set where certain vectors reside that have the same properties in common.

Following that, we have defined certain properties of that vector space. We start from the basis of an equation that determines whether two vectors are linearly dependent or linearly independent. Let’s see a little how the linear dependence and independence of vectors works:

Linearly dependent vectors: A set of vectors will be linearly dependent if any of them can be expressed as a linear combination of the rest.
Linearly independent vectors: A set of vectors will be linearly independent if none of them can be expressed as a linear combination of the rest of the vectors.

Base change in vector spaces

The base is nothing more than a set of vectors v1, v2, …vn that are linearly independent and that are capable of generating any vector of said space (we are talking about the same vector space).

The idea is that we want to build a matrix that allows us to change the coordinates of a vector in one base for the coordinates of the same vector in another base. To do this, let’s take a pair of bases from the same vector space:

A = a1, a2, … an

B = b1, b2, … bn

To do this, we calculate the matrix B from the vectors b1,…, bk and the matrix A from the vectors a1,…, an.

Remember that we had defined this transformation: AX = B. Well, the formula for changing bases in vector spaces works the same, but all we want is to change from one base to another.

Here, in the above formula, what we want to calculate is X. However, X takes another name, now it is called base change.

We have already seen that to solve for X we have to multiply on both sides by the inverse matrix and, then, we will obtain the expected result.

The base change matrix C is defined as:

This matrix maps a vector in the base b1, …, bk and converts it to a vector in the base a1, …, an.

Exercise on change of base in vector spaces

Let’s look at a simple exercise to see how base change works in vector spaces.

We are going to calculate the base change matrix in vector spaces of the base

B = [1, 2, 3], [2, 1, 0], [0, 1, 4] to base A = [2, 0, 1], [0, 1, -1], [1, 2, 0].

The first thing we will do is define the array B using np.array; Then, we will define the matrix A. To make the base change in vector spaces, we have to calculate the inverse of A x B:

#Change of basis in vector spaces import numpy as np B = np.array ([[1, 2, 3],
[2, 1, 1],
[3, 0, 4]]) A = np.array ([[2, 0, 1],
[0, 1, -1],
[1, 2, 0]]) inv_A = np.linalg.inv (A) print (inv_A)

[[ 0.66666667 0.66666667 -0.33333333]

[-0.33333333 -0.33333333 0.66666667]

[-0.33333333 -1.33333333 0.66666667]]

Now the matrix C will be the matrix product of the inverse x B:

#Change of basis in vector spaces C = np.dot (inv_A, B) print (C)

[[ 1, 2. -1.33333333]

[ 1, -1. 1.33333333]]

[ -1, -2. 0.33333333]

To convert the vector [1, 2, 3] to the base [2, 0, 1], [0, 1, -1], [1, 2, 0]:

#Change of basis in vector spaces v = np.array ([[1],
[2],
[3]]) np.dot (C, v)

In real life, rebasing is used for many things, including removing perspective from an image.

Base change in vector spaces: perspective

array (

[[9.],

[3.],

[-4.]])

Do you want to continue learning?

Now that you have learned everything you need to know about linear transformation and matrices, you can continue training in the world of Big Data to become an expert in the sector.

If you want to access one of the most in-demand disciplines with the best salaries in the labor market, check out the Big Data, Artificial Intelligence & Machine Learning Full Stack Bootcamp now, a comprehensive training in which you will acquire, in just a few months, all the knowledge you need. They will help you get the job of your dreams. Enter now to request information and dare to boost your future!

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *