Don't understand visualization of linear combination

Screen Link:
https://app.dataquest.io/c/39/m/161/vectors/7/linear-combination

I’ve spent quite a bit of time on figuring this one out but failed. :sweat:

I don’t understand how this diagram shows the above mentioned problem visually.
I’ve attached a screenshot highlighting what I understood. Obviously the vectors v and w come from the example but how did we draw up the remaining vectors like the vector representing 2v or the vector -2v±w.

I would also appreciate it if you could tell me how from there we got to the visualization showing the solution.

If there is some reference I should be reading to understand this better, sharing it would help all the same.

1 Like

Hi @jesmaxavier. Try thinking of w and v as Lego pieces that we can put together in order to “land” on a particular coordinate (in this case, (4, -2)).

This analogy will work in this example because we are only looking at integer values for c1 and c2. So, we can rethink this problem as: “How many orange and blue Lego pieces (i.e. how many ws and vs) do we need to land on (4, -2)?” Since vectors have a direction as well as a magnitude, we can add or subtract our “Lego pieces” to allow for more freedom of movement on our grid. Making one of our vectors (Lego pieces) negative means that instead of going right, we go left, and instead of going up, we go down. In other words, we reverse the signs on the components of our vector.

So, for example, when we say w + 2v, what we’re saying is: “one orange Lego added to two blue Legos.” Using algebra, this becomes: (1, 2) + 2 * (3, 1) = (1, 2) + (6, 2) = (7, 4) which is the coordinate we land on when we add these vectors together.

As another example, -2v + -w means: “two negative blue Legos added to one negative orange Lego.” Using algebra, this becomes: -2 * (3, 1) + -1 * (1, 2) = (-6, -2) + (-1, -2) = (-7, -4) which is the coordinate we land on when we add these vectors together.

In the end, we discover that using -2w + 2v (two negative orange Legos added to two blue Legos) will get us to the desired coordinate of (4, -2). This was “discovered” simply by looking at the diagram and using combinations of pos/neg blue/orange Lego pieces and seeing if we can “build our way” from the origin (0,0) over to our destination (4, -2).

Why -2w + 2v is the solution

-2w + 2v = -2 * (1, 2) + 2 * (3, 1) = (-2, -4) + (6, 2) = (4, -2)

@mathmike314 thanks for taking the time and having the patience to provide an answer.

First off, thank you for explaining with the coordinates. My first blocker to understanding was looking at the vectors as variables so I failed to connect the idea of vectors and coordinates. I just saw v and w as x and y variables of a linear equation like x+2y=4.

Secondly, while your analogy of lego blocks is clear, what I don’t understand is how this diagram represents “the problem visually”. The problem does not contain any of the vectors in the diagram (i.e. w+v,w+2v,-2v,-w+2v etc) so whats to stop me from using 3v instead of 2v+v.

Moreover the point the vectors were supposed to reach in the problem is (4,-2), however in the visualization the point the vectors reach are (7,4) and (-7,-4) which are not related to (4,-2) so what was the point of getting to those points?

Thirdly, with regards to finding the solution, are we using vectors to find the solution visually? That is just drawing vectors on a graph continuously till we get to our solution. I ask because you mentioned that the solution was “discovered”.

Finally can you tell me how you brought about this control while answering image

In order to understand this, let’s look at how the problem was given in the Learn section:

For example, we may want to know if we can combine the vectors \begin{bmatrix} 3\\ 1 \end{bmatrix} and \begin{bmatrix} 1\\ 2 \end{bmatrix} to obtain \begin{bmatrix} 4\\ -2 \end{bmatrix}
Here’s what our problem looks like mathematically:
c_1 \begin{bmatrix} 3\\ 1 \end{bmatrix} + c_2 \begin{bmatrix} 1\\ 2 \end{bmatrix} = \begin{bmatrix} 4\\ -2 \end{bmatrix}

Mathematically, what this is asking us is: “can we find integer values for c_1 and c_2 such that the above equation is true?” Therefore, this could also be represented visually by taking combinations of v and w to see if we can construct the vector \begin{bmatrix} 4\\ -2 \end{bmatrix} by using combinations of \begin{bmatrix} 3\\ 1 \end{bmatrix} and \begin{bmatrix} 1\\ 2 \end{bmatrix}.

Each of the vectors in the diagram (i.e. w+v,w+2v,-2v,-w+2v etc) are simply linear combinations of w and v and you should look at each combination as being an “attempt at a solution.” Of course, none of them are solutions because none get us the vector we want: \begin{bmatrix} 4\\ -2 \end{bmatrix}

There is nothing stopping you from using 3v instead of 2v +v since these two expressions are algebraically equivalent…however, it is not a solution to our problem because 3v does not produce the desired vector.

One last point I’d like to make here is the connection between the linear combination of vectors (v and w) and the constants (c_1 and c_2) mentioned initially in the problem: if we construct the vector -2v + -w what we are really doing is testing to see if c_1 = -2 and c_2 = -1 is a solution to our problem. Since this combination does not produce the vector \begin{bmatrix} 4\\ -2 \end{bmatrix}, we conclude that c_1 = -2 and c_2 = -1 is not a solution and we must try other values for c_1 and c_2 that might satisfy the equation.

The purpose of this first diagram is to demonstrate how we can linearly combine v and w in order to produce different vectors. If this first diagram were to show the combination of v and w that produces the desired vector (this happens when c_1=2 and c_2=-2), it would be visually representing the solution and would rob us from the opportunity to experiment with combinations of v and w that might produce our desired vector. In the end, the purpose of this first diagram is to experiment and perhaps give us clues as to what values we might use for c_1 and c_2 to solve our problem.

I haven’t actually done this lesson and only looked at this one screen from the mission so I don’t have much context, but that was my understanding: find a solution by visually examining and experimenting with values of c_1 and c_2.

To use the Hide Details feature in a message, just click on the little cog on the messaging toolbar (last icon on the right, next to the calendar for insert date/time) and select Hide Details.

1 Like

@mathmike314 you do justice to your name (mathmike) :grinning_face_with_smiling_eyes:

Thank you very much especially for going out of the way to answer despite not having done the lesson!! Its very clear now. What got my stumped was the final vector points highlighted in the problem. I think this problem is best visualized using a .gif so that we can see the vectors in actions and highlight how we go about solving it.

Cheers bud!! :+1:

1 Like