As we already learnt what a linear combination is, in the previous topic, we can easily define linear independence.

Linear Independence

**Definition:** A list of vectors is said to be linearly independent if none of the vectors in the list can be written as a linear combination of the others.

In other words, a list of vectors is said to be linearly independent if and only if there is no vector in the list which is in the span of the preceding vectors.

**Theorem:** A list of vectors is said to be linearly independent if and only if there is no vector in the list which is in the span of the preceding vectors.

**Proof:**

According to the definition of Linear Independence, if a list of vectors is linearly independent, no other vector in the list can be represented as the linear combination of others. This means, no vector can be in the span of the rest of the vectors in the list.

Let’s suppose there exists a list of vectors v_{1} , v_{2} ,…, v_{n} in which no vector is in the span of the remaining vectors. Note that such a list necessarily does not contain 0.

Assumption: The list of vectors v_{1}, v_{2},…, v_{n} is linearly dependent.

According to our assumption, one of the vectors could be written as the linear combination of the others. Without the loss of generality, let us suppose v_{1} is such a vector which can be written as the linear combination of the others, then:

for some c_{2}, c_{3},….,c_{n} which are not all zero. Let c_{k} be the last non-zero c, then we obtain:

Hence, we arrive at a contradiction. Therefore, the vector-list v_{1}, v_{2},…, v_{n} must be linearly independent.

Now that we understand what linear dependence and linear independence is, let us view some geometrical examples illustrated in 3D space.

- If any two of the vectors are parallel, then it means one vector is a scalar multiple of the other. A vector being able to be written as a scalar multiple of the other is nothing but the linear combination, so the vectors are linearly dependent as demonstrated below.

- If no two of the vectors are parallel among the three but all three lie in a plane, then any two of those vectors will be able to span that plane. This means, the third vector is a linear combination of the first two, since it also lies in this plane, so these kinds of vectors are also linearly dependent.

- If the three vectors don’t all lie in some plane at once through the origin, none is in the span of the other two, so none of the vectors is a linear combination of the other two. Such three vectors are linearly independent.

**Test for Linear Dependence and Independence of Vectors**

We perform the following test to know if one of the vectors is some combination of the other vectors in a set.

Two vectors u and v are linearly independent if the only real numbers x and y satisfying the equation are .

Let’s say, and , then will be equivalent to

If u and v are linearly independent, then the only solution to this system of equations is the trivial solution, . For homogeneous systems this happens precisely when the determinant is non-zero.

So, to determine whether a given set of vectors is linearly independent we perform the following test: A set of n vectors of length n is linearly independent if the matrix with these vectors as columns has a non-zero determinant while it’s dependent if the determinant is zero.

**Q: Find out whether the vectors and are linearly dependent or independent.**

` ````
```%use s2
// define vectors x,y,z
var x = DenseVector(arrayOf(1.0, 2.0, 3.0))
var y = DenseVector(arrayOf(3.0, 2.0, 1.0))
var z = DenseVector(arrayOf(0.0, 4.0, 8.0))
// Create a 3x3 matrix for x, y, z
val A = DenseMatrix(arrayOf(
doubleArrayOf(1.0, 3.0, 0.0),
doubleArrayOf(2.0, 2.0, 4.0),
doubleArrayOf(3.0, 1.0, 8.0)))
//find the determinant
val det: Double = MatrixMeasure.det(A)
//if det is zero, printing "LINEARLY DEPENDENT"
if (det==0.0)
println("LINEARLY DEPENDENT")
else //else printing "LINEARLY INDEPENDENT"
println("LINEARLY INDEPENDENT")

Spans of lists of vectors are so crucial that we give them a special name: A vector space is a nonempty set

of vectors which is closed under the vector space operations. If V and W are vector spaces and V ⊂ W, then

V is called a subspace of W.

- Lines and planes through the origin are vector subspaces of . More generally, the span of any list of vectors in is a vector subspace of .

- A spanning list of a vector space V is a list of vectors in V whose span is equal to V.

Example:

The list is a spanning list for because any vector can be represented as:

**Basis**

A linearly independent spanning list for a vector space V is called a basis for V.

Ex: The list is a basis for .

Q: Determine whether is a basis for .

` ````
```%use s2
// define vectors x,y.
var x = DenseVector(arrayOf(2.0, 1.0))
var y = DenseVector(arrayOf(1.0, 1.0))
// Create a 2x2 matrix for x, y
val A = DenseMatrix(arrayOf(
doubleArrayOf(2.0, 1.0),
doubleArrayOf(1.0, 1.0)))
//find the determinant
val det: Double = MatrixMeasure.det(A)
//if det is zero, it means the set of vectors is Linearly Dependent, so it's "NOT A BASIS"
if (det==0.0)
println("($x,$y) is Not a Basis for R2")
else //else, Linearly Independent, i.e., it's a "BASIS"
println("($x,$y) is a Basis for R2")

**Theorem: **If V is a vector space, then any spanning list of V is at least as long as any linearly independent list of vectors in V.

In other words, if L_{1} is a linearly independent list of vectors in V and L_{2} is a list of vectors which spans V, then the length of L_{1} is less than or equal to the length of L_{2}_{.}

**Note:** All bases of a vector space V have the same length.

Linear Transformation

Let be real vector spaces then, a linear transformation is a function from to which satisfies .

In , reflection along the line , defined by is linear because,

=

=

**Rank of a Linear Transformation**

The rank of a linear transformation from one vector space to another is the dimension of its range.

If , then the rank of is since its range is the -plane in .

Q: Find the rank of the linear transformation defined by the matrix .

` ````
```%use s2
// Create the matrix
val A = DenseMatrix(arrayOf(
doubleArrayOf(1.0, 0.0, -2.0),
doubleArrayOf(0.0, 1.0, 1.0),
doubleArrayOf(0.0, 0.0, 0.0)))
// Compute the rank
val precision = 1e-15
val rank = MatrixMeasure.rank(A, precision)
println("rank: $rank")

**Null Space of a Linear Transformation**

The null space of a linear transformation is the set of vectors which are mapped to the zero vector by the linear transformation.

If , then the null space of is span since implies that for some .

Let us illustrate the above example using s2.

The matrix for the above linear Transformation will be:

Approach: The Null Space of is the span of all vectors such that .

` ````
```%use s2
// Create a matrix
val A = DenseMatrix(arrayOf(
doubleArrayOf(0.0, 1.0, 1.0),
doubleArrayOf(0.0, -1.0, 1.0),
doubleArrayOf(0.0, 0.0, 0.0)))
// Create a solver for linear system
val precision = 1e-15
val solver = LinearSystemSolver(precision)
// solutions for Ax = 0
val soln: LinearSystemSolver.Solution = solver.solve(A)
// xList is a list of possible homogeneous solutions
val xList = soln.homogeneousSoln
println("Null Space of A is the span of: ${xList.toTypedArray().contentToString()}")