what is linearity in linear algebra
In the lessons ahead you will meet matrices, determinants, and eigenvalues, and a single property keeps all of them running: linearity. The name sounds grand, but it means one thing. You can split a problem apart, handle the pieces separately, put the results back together, and get exactly what you would have gotten by handling it all at once. It is a promise that complicated things can be solved in simple pieces. The previous lesson, "A Vector Is a Movement," showed that every vector is a combination of î and ĵ, and the coming lesson, "Matrices Are Transformations," will say a matrix only has to track î and ĵ. Linearity is what links the two, and this lesson is the bridge.
A transformation is linear when it obeys exactly two rules. First, adding and then transforming gives the same result as transforming and then adding. Second, scaling and then transforming gives the same result as transforming and then scaling by the same factor. In the figure, the two faint arrows are the inputs, and the bright green and orange arrows are their transformed versions. The dashed orange segment attaches the orange arrow to the tip of the green one, and its end lands exactly on the tip of the gold arrow, the result of adding the inputs first and then transforming. Drag the dark handles a and b anywhere and the two routes always arrive at the same point; the two rules are written out below the figure. Obey these two rules and the transformation is linear. The promise looks modest, yet almost every computation that follows leans on it.
Start with the first rule. One route adds a and b first, as a+b, and then transforms; the other transforms each one separately and then adds the results. In the figure, the gold diagonal is the first route, and the parallelogram whose two sides are the green and orange arrows is the second. The far corner of the parallelogram coincides exactly with the end of the gold diagonal, so it makes no difference whether you add first or transform first. Move the handles a and b around and the parallelogram still closes at the gold endpoint. So you never need to handle the combined thing as a whole; you can handle the parts separately.
The second rule. Stretch a vector v by 3 and then transform it, or transform v and then stretch the result by 3: once again the two agree. Double the input and the output exactly doubles; triple it and the output triples, in clean proportion. In the figure, the faint arrow is the reference output. Change the factor c with the slider and the gold arrow stretches and shrinks along the dashed line by that factor. When c goes negative, the arrow flips to the other side and turns red, yet it never leaves the same line. Whether the stretching comes before or after makes no difference, and whatever you put into the input shows up unchanged in the output. That is the core feel of linearity.
Combine the two rules and a powerful conclusion follows. As the previous lesson, "A Vector Is a Movement," showed, any vector splits into an î piece and a ĵ piece, and thanks to linearity the transformation acts on each piece separately; you then just add the results. As a formula: transform(any vector) = (amount of î in it) × transform(î) + (amount of ĵ) × transform(ĵ). Know where the transformation sends î and ĵ, and the infinitely many other vectors all follow. Drag the input vector by its handle: on the output side, the dashed green line lays out as many copies of the transformed î as needed, and the dashed orange line adds copies of the transformed ĵ, ending at the tip of the blue output arrow. The equation below shows the counts used. This is exactly why, in the coming lesson "Matrices Are Transformations," a matrix can be written with just two columns for î and ĵ; linearity takes care of the rest.
This property has a famous name in engineering: the superposition principle. If input A produces output A and input B produces output B, then input A+B produces exactly output A+B. Combining things brings no surprises. Step through the figure with the buttons: input A and its output appear, then input B and its output, and in the final step the dashed orange segment attached to the tip of the green output lands right on the tip of the gold output. So a messy input can be broken into simple pieces, each piece solved, and the answers added. Breaking a sound into pure tones with Fourier analysis, and analyzing a circuit by working out each source separately and adding the results, are both superposition. Nonlinear things do not allow this. Just look at squaring: (a+b)² is not a²+b², and combining makes an unexpected term pop out. That is why nearly every problem we can solve cleanly is linear.