Skip to content
Glacius
Linear algebraConcept reference

Linearity

A map between real vectors is linear when it preserves addition and multiplication by every real scalar for all inputs.

On this page 7 sections
  1. Overview
  2. The two rules of linearity
  3. A linear map: doubling a vector
  4. What a counterexample proves
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01The two rules of linearity#

For T:RnRmT:\mathbb R^n\to\mathbb R^m, linearity needs two rules. Additivity preserves sums for all input vectors u,vu,v.

Combine inputs or combine outputs:

T(u+v)=T(u)+T(v)\begin{gathered}T(u+v)\\=T(u)+T(v)\end{gathered}

Homogeneity preserves scaling. For every input vector uu and every real scalar cc:

Scale the input or the output:

T(cu)=cT(u)T(cu)=cT(u)

Both rules must hold for T to be linear.

02A linear map: doubling a vector#

Take T(v)=2vT(v)=2v on real vectors. For arbitrary u,vu,v, distribute the doubling over each coordinate sum.

Apply T to the sum:

T(u+v)=2u+2vT(u+v)=2u+2v

This also equals T(u)+T(v)T(u)+T(v). Additivity holds for every pair.

For T(v)=2vT(v)=2v and any real cc, scaling the input gives T(cv)=2(cv)T(cv)=2(cv).

Real scalar multiplication lets us write

2(cv)=c(2v)=cT(v)2(cv)=c(2v)=cT(v)

So homogeneity holds too. With both rules valid for all inputs, T(v)=2vT(v)=2v is linear.

Check your reasoning

For T(x)=x+2T(x)=x+2 on R\mathbb R, find T(1+1)2T(1)T(1+1)-2T(1).

Show answer and explanation
-2

The sides are 44 and 66. Their difference is 2-2, so additivity fails.

03What a counterexample proves#

A linear map must send 0 to 0: set c=0c=0 in homogeneity. Passing that test alone proves too little.

For T(x)=x2T(x)=x^2 on real numbers, T(0)=0T(0)=0. Yet T(1+1)=4T(1+1)=4 while T(1)+T(1)=2T(1)+T(1)=2. This failure disproves linearity.

Check your reasoning

A sensor uses T(x)=xT(x)=|x| for real xx. What are T(2)T(-2) and T(2)-T(2), in order?

  1. A(2,2)(2,-2)
  2. B(2,2)(-2,-2)
  3. C(2,2)(2,2)
Show answer and explanation
(2,2)(2,-2)

The outputs are 22 and 2-2, so homogeneity fails.

One failed check disproves linearity. A finite set of passing numerical checks cannot prove that both rules hold for every input.

The curve is T(x)=x+1. It passes through (1,2), (2,3), and (3,4). The dashed gold level at height 5 represents T(1)+T(2)=2+3, not the curve value at x=3. The difference between 4 and 5 disproves additivity.The curve is T(x)=x+1. It passes through (1,2), (2,3), and (3,4). The dashed gold level at height 5 represents T(1)+T(2)=2+3, not the curve value at x=3. The difference between 4 and 5 disproves additivity.
Figure 1These unequal outputs give one additivity counterexample.
Link to this figure ↗Download SVGDownload PNG
Check your reasoning

Do 20 passed addition tests prove a real-vector map linear?

  1. AYes; 20 suffice.
  2. BYes, if T(0)=0T(0)=0.
  3. CNo; finite checks are insufficient.
Show answer and explanation
No; finite checks are insufficient.

Both rules must hold for all inputs.

Key takeaway

Prove both rules for all inputs; one failure disproves linearity.

  • Check both addition and real-scalar preservation.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Linearity.” Math behind ML. /learn/la-linearity