# How to find a linearly independent vector?

Given two vectors $(1,2,8),(0,1,9)$ find a 3rd vector that is linearly independent from these two vectors.

I sort of have an idea how to go about solving the problem but I'm not 100% sure. I'm know we just want to find a vector that can't be written as the sum of the two given vectors but how exactly do I go about finding one such vector?

Got it now many thanks to all the helpers some brilliant explanations.

• Have you learned about cross product of two vectors? Commented Mar 16, 2015 at 20:28
• Yes although I'm not sure how that would relate? Something to do with not being able to make that vector since it is perpendicular? Commented Mar 16, 2015 at 20:30
• The result of a cross product is always perpendicular on the two given input vectors of the cross product. Because you have now 2 vectors which span a 2 dimensional plane and also a third perpendicular on those, you can create now all vectors in ${\mathbb{R}}^3$. So all vectors are linearly independent of each other then. Commented Mar 16, 2015 at 20:33
• Hint: the set of all linear combinations of your two vectors, denoted $\operatorname{span}[(1,2,8),(0,1,9)]$, is a plane in $\Bbb R^3$. If you choose any vector which is not in that plane, you'll have found a third vector which forms a linearly independent set with your two vectors.
– user137731
Commented Mar 16, 2015 at 20:34
• @user46944 yes I see that but my vectors aren't $(1,0,0),(0,1,0)$ so I was wrongly assuming because you have that all components of the first vector are non-zero then you can take a linear combination to find any vector you wish by just altering $c_1, c_2$ to get the vector you desire. Commented Mar 16, 2015 at 20:51

I like your idea about finding a vector that can't be written as a sum of the two vectors above. Let's take a look at what that would look like.

Every possible sum of these two vectors can be expressed as $c_{1}(1,2,8) + c_{2}(0,1,9)$ for some $c_{1}, c_{2}$ in $\Bbb R$. So, all possible sums can be expressed in the form $(c_{1}, 2c_{1} + c_{2}, 8c_{1} + 9c_{2})$.

We want to come up with a third vector $(v_{1}, v_{2}, v_{3})$ that can't be expressed in the above form. Whatever $c_{1}$ and $c_{2}$ you pick for the linear combination above, we need that the third component $v_{3}$ is exactly $8c_{1} + 9c_{2}$. Let's pick a vector whose third component is different from this (i.e., pick $c_{1}$ and $c_{2}$, and fill in the first two components of $(c_{1}, 2c_{1} + c_{2}, 8c_{1} + 9c_{2})$, but make the third component different from this).

So, even though you can pick $c_{1}$ and $c_{2}$ to be anything, I will pick $c_{1} = c_{2} = 1$. Then the vector I will construct will be:

$(1c_{1}, 2c_{1} + 1c_{2}, 11) = (1, 2 + 1, 11) = (1, 3, 11)$

Notice that I made the third component different from $8c_{1} + 9c_{2} = 8 + 9 = 17$. Then this new vector can't be written as a linear combination of the previous two vectors, because that's how we constructed it.

• Brilliant answer. Commented Mar 16, 2015 at 20:49
• @CallumK It's all based on your initial suggestion. Good for you for thinking in the right way. Commented Mar 16, 2015 at 20:49
• Cheers @Karl! :) Commented Mar 16, 2015 at 21:02

Here's a simple method: you want to find a vector $(a,b,c)$ such that the system $$x(1,2,8)+y(0,1,9)=(a,b,c)$$ has no solution. It's a linear system because it can be written as $$\begin{cases} x=a\\ 2x+y=b\\ 8x+9y=c \end{cases}$$ The matrix of this system is $$\left[\!\begin{array}{cc|c} 1 & 0 & a \\ 2 & 1 & b \\ 8 & 9 & c \end{array}\!\right]$$ If we proceed with Gaussian elimination we get \begin{align} \left[\!\begin{array}{cc|c} 1 & 0 & a \\ 2 & 1 & b \\ 8 & 9 & c \end{array}\!\right] &\to \left[\!\begin{array}{cc|c} 1 & 0 & a \\ 0 & 1 & b-a \\ 0 & 9 & c-8a \end{array}\!\right] \\&\to \left[\!\begin{array}{cc|c} 1 & 0 & a \\ 0 & 1 & b-a \\ 0 & 0 & c-8a-9b+9a \end{array}\!\right] \end{align} so we just need to have $$a-9b+c\ne0$$ and we can choose whatever values of the parameters, so for example $a=1$, $b=0$ and $c=0$.

Of course infinitely many other choices are possible.

A different method is finding a non zero vector which is orthogonal to the two given vectors; if the vector is $(a,b,c)$ we get $$\begin{cases} a+2b+8c=0\\ b+9c=0 \end{cases}$$ This gives $a=-2b-8c$ and $b=-9c$. So we can set $c=1$ and get $b=-9$, $a=10$.

With the first method we find all vectors that solve our problem, but your task is just finding one, so take your pick.

• Very nice also cheers. Commented Mar 16, 2015 at 21:05

Sorry to add to an old question, but it came up for me and I think this method may be useful for others. The method is equivalent to @egreg's answer, but maybe a bit easier to implement programmatically when you need the last vector to make a complete basis - a square matrix of linearly independent rows and columns - as in this question.

A matrix with linearly independent rows has a non-zero determinant, so if you want to find the vector $$(a,b,c)$$ to make a complete basis, we need

$$\begin{vmatrix} a & b & c \\ 1 & 2 & 8 \\ 0 & 1 & 9 \\ \end{vmatrix} \neq 0$$

The determinant can be computed with the elements in the top row and the minors (the Laplace expansion), so we get

$$a \begin{vmatrix} 2 & 8 \\ 1 & 9 \\ \end{vmatrix} - b \begin{vmatrix} 1 & 8 \\ 0 & 9 \\ \end{vmatrix} + c \begin{vmatrix} 1 & 2 \\ 0 & 1 \\ \end{vmatrix} \neq 0$$

which again is

$$10a - 9b + c \neq 0$$

Any $$(a,b,c)$$ that satisfies that will be linearly independent. A really simple approach would be just to pick one of the elements with non-zero coefficients and set it to $$1$$, and set the other elements to zero. In this case none of the coefficients are zero, so $$(1,0,0)$$, $$(0,1,0)$$, and $$(0,0,1)$$ are all linearly independent with the first two vectors you gave.

• Yes, this is my strategy, too. After all, the two given vectors span a plane, while the whole space is three-dimensional. So almost any “random” triple $(r,s,t)$ should do the trick. Commented Aug 7, 2020 at 20:32
• That's a really interesting way to look at it. Statistically, if you chose a random 3D vector, there's a 100% chance that it will be linearly independent. That being said, using the determinants is useful if you're working with integers and especially finite fields (eg binary matrices). Commented Aug 8, 2020 at 22:50
• Absolutely. You take your “random” third vector and check by computing the determinant. Exactly what you did, which is why you got my only plus-one on this question. Commented Aug 9, 2020 at 14:39

You can calculate the orthogonal complement for any n dimensional space. In MATLAB:

A = [1 2 8 ; 0 1 9];
p = null(sym(A))
10
-9
1
dot(p,A(1,:))
0
dot(p,A(2,:))
0