# Linear Independence¶

A set of vectors \(\{V_1, V_2, V_3, ... V_n\}\) is said to be **linearly independent** if no linear combination of the vectors is equal to zero, except the combination with all weights equal to zero. Thus if the set is linearly independent and

it must be that \(c_1 = c_2 = c_3 = .... = c_n = 0\). Equivalently we could say that the set of vectors is linearly independent if there is *no vector in the set* that is equal to a linear combination of the others. If a set of vectors is not linearly independent, then we say that it is **linearly dependent**.

## Example 1: Vectors in \(\mathbb{R}^2\)¶

In order to determine if this set of vectors is linearly independent, we must examine the following vector equation.

```
import numpy as np
import laguide as lag
A_augmented = np.array([[2,1,0],[1,-6,0]])
print(lag.FullRowReduction(A_augmented))
```

```
[[1. 0. 0.]
[0. 1. 0.]]
```

We see from the reduced augmented matrix that the only solution to the equation is \(c_1 = c_2 = 0\). The set \(\{V_1, V_2\}\) is linearly independent.

## Example 2: Vectors in \(\mathbb{R}^3\)¶

Again, we must examine the solution to a vector equation.

```
B_augmented = np.array([[2,1,3,0],[-1,-4,2,0],[1,0,2,0]])
print(lag.FullRowReduction(B_augmented))
```

```
[[ 1. 0. 2. 0.]
[ 0. 1. -1. 0.]
[ 0. 0. 0. 0.]]
```

In this case we see that \(c_3\) is a free variable. If we set \(c_3 = 1\), then \(c_2 = 1\), and \(c_1 = -2\). Since we are able to find a solution other than \(c_1 = c_2 = c_3 = 0\), the set of vectors \(\{W_1, W_2, W_3\}\) is linearly dependent.

## Homogeneous systems¶

A linear system is said to be **homogeneous** if it can be described with the matrix equation \(AX = 0\). The solution to such a system has a connection to the solution of the system \(AX=B\). The homogeneous system also has a connection to the concept of linear independence. If we link all of these ideas together we will be able to gain information about the solution of the system \(AX=B\), based on some information about linear independence.

In the previous examples we were solving the vector equation \(c_1V_1 + c_2V_2 + c_3V_3 + .... + c_nV_n = 0\) in order
to determine if the set of vectors \(\{V_1, V_2, V_3 .... V_n\}\) were linearly independent. This vector equation represents a homogeneous linear system that could also be described as \(AX=0\), where \(V_1\), \(V_2\), … \(V_n\) are the columns of the matrix \(A\), and \(X\) is the vector of unknown coefficients. The set of vectors is linearly dependent if and only if the associated homogeneous system has a solution other than the vector with all entries equal to zero. The vector of all zeros is called the **trivial solution**. This zero vector is called a trivial solution because it is a solution to *every homogeneous system* \(AX=0\), regardless of the entries of \(A\). For this reason, we are interested only in the existence of *nontrivial solutions* to \(AX=0\).

Let us suppose that a homogeneous system \(AX=0\) has a nontrivial solution, which we could label \(X_h\). Let us also suppose that a related nonhomogeneous system \(AX=B\) also has some particular solution, which we could label \(X_p\). So we have \(AX_h = 0\) and \(AX_p = B\). Now by the properties of matrix multiplication, \(X_p + X_h\) is also a solution to \(AX=B\) since \(A(X_p + X_h) = AX_p + AX_h = B + 0\).

Consider the following system as an example.

We can look at the associated homogeneous system to determine if the columns of \(A\) are linearly independent.

```
A_augmented = np.array([[-3,2,1,0],[-2,1,-1,0],[4,-3,-3,0]])
A_augmented_reduced = lag.FullRowReduction(A_augmented)
print(A_augmented_reduced)
```

```
[[1. 0. 3. 0.]
[0. 1. 5. 0.]
[0. 0. 0. 0.]]
```

The absence of a pivot in the third column indicates that \(c_3\) is a free variable, and that there exists a nontrivial solution to the homogeneous system. One possibility is \(c_1 = 3\), \(c_2=5\), \(c_3 = -1\). It is worth noting here that it was unnecessary to carry out the row operations on the last column of the augmented matrix since all the entries are zero. When considering homogeneous systems, finding the RREF of the coefficient matrix is enough.

The fact that the homogeneous system has a nontrivial solution implies that the columns of \(A\), if we think of them as vectors, are linearly dependent. Based on the discussion then, we expect that if the \(AX=B\) system has a solution, it will not be unique.

```
A_augmented = np.array([[-3,2,1,-6],[-2,1,-1,1],[4,-3,-3,13]])
A_augmented_reduced = lag.FullRowReduction(A_augmented)
print(A_augmented_reduced)
```

```
[[ 1. 0. 3. -8.]
[ 0. 1. 5. -15.]
[ 0. 0. 0. 0.]]
```

The RREF represents two equations, and again the third variable is free.

To express the possible solutions, we can set \(x_3 = t\), which gives \(x_2 = -15 -5t\) and \(x_1 = -8-3t\). These components can be assembled into a vector that involves the parameter \(t\).

Splitting this vector into two pieces helps us connect this solution to that of the homogeneous system.

We can check to see that \(AX_p= B\), \(AX_h= 0\) for any \(t\), and \(A(X_p+X_h) = B\) for any \(t\).

```
A = np.array([[-3,2,1],[-2,1,-1],[4,-3,-3]])
X_p = np.array([[-8],[-15],[0]])
X_h = np.array([[-3],[-5],[1]])
t = np.random.rand()
X = X_p + t*X_h
print(X)
print('\n')
print(A@X_p)
print('\n')
print(A@(t*X_h))
print('\n')
print(A@X)
```

```
[[-10.06746623]
[-18.44577706]
[ 0.68915541]]
[[-6]
[ 1]
[13]]
[[ 1.11022302e-15]
[ 6.66133815e-16]
[-8.88178420e-16]]
[[-6.]
[ 1.]
[13.]]
```

It is important to notice that the first three columns of the RREF for the augmented matrix of the homogeneous system are exactly the same as those of the RREF for the system \(AX=B\). Of course that must be the case since the first three columns come from the coefficient matrix \(A\), which is the same in both systems. The point here is that **the system \(AX=B\) can only have a unique solution if the columns of \(A\) are linearly independent**.

## Null space¶

With the concept of homogeneous systems in place, we are ready to define the second fundamental subspace. If \(A\) is an \(m\times n\) matrix, the **null space** of \(A\) is the set of vectors \(X\), such that \(AX=0\). In other words, the null space of \(A\) is the set of all solutions to the homogeneous system \(AX=0\). The null space of \(A\) is a subspace of \(\mathbb{R}^n\), and is written with the notation \(\mathcal{N}(A)\). We can now reformulate earlier statements in terms of the null space.

The columns of a matrix \(A\) are linearly independent if and only if \(\mathcal{N}(A)\) contains only the zero vector.

The system \(AX=B\) has at most one solution if and only if \(\mathcal{N}(A)\) contains only the zero vector.

Making connections between the fundamental subspaces of \(A\) and the solution sets of the system \(AX=B\) allows us to make general conclusions that further build our understanding of linear systems, and the methods by which we might solve them.

## Exercises¶

**Exercise 1:** Determine if the set of vectors \( \{U_1, U_2, U_3\} \)is linearly independent.

```
## Code solution here.
```

**Exercise 2:** Determine whether or not the set of vectors \( \{W_1, W_2, W_3, W_4 \} \) is linearly independent. If the set is linearly dependent, then represent one of the vectors of the set as the linear combination of others.

```
## Code solution here
```

**Exercise 3:** Find the value of \(b\) for which the given vectors are linearly dependent. Then, represent one vector as the linear combination of the other two.

```
## Code solution here
```

**Exercise 4:** Find the value(\(s\)) of \(a\) such that the set of vectors \( \{V_1, V_2, V_3\} \) is linearly independent.

```
## Code solution here
```

**Exercise 5:** Use the concept of linear independence of vectors to show that the given system does not have infinitely many solutions.

```
## Code solution here
```

**Exercise 6:** Can you find a nonzero vector in the null space of the matrix \(A\)? Use this information to determine the number of solutions for the system \(AX = B\), where \(B\) is any vector in $\mathbb{R}^3$.

```
## Code solution here
```

**Exercise 7:** Find two distinct nonzero vectors in the null space of the matrix \(D\).

```
## Code solution here.
```

**Exercise 8:**
Suppose the vector \(X\) given below is a solution for a system \(AX = B\) for any value of \(t\).

\((a)\) Following the discussion in this section on homogeneous systems, find \(X_h\) and \(X_p\) so that \(X= X_p+X_h\) so that \(X_p\) is the solution to some system \(AX=B\) and \(X_h\) is the solution to the corresponding homogeneous system \(AX=0\).

\((b)\) Given the coefficient matrix \(A\), find \(B\).

```
## Code Solution here
```