Tutorials › Linear Algebra › Defining Composition of Linear Transformations

Linear Transformations of R^n · Tutorial 203 of 1000

Defining Composition of Linear Transformations

Learn to define a composite by applying one map after another, track its domain and codomain, and verify its linearity.

Intermediate 9 min read

What You'll Learn

  • Define \(S\circ T\) when the output space of \(T\) matches the input space of \(S\).
  • Track the domain and codomain of a composite from those of its component maps.
  • Prove that composing linear transformations produces a linear transformation.
  • Evaluate composites by applying the inner map first and the outer map second.
  • Recognize why a composite’s declared codomain need not equal its image.
  • Use associativity to compare two ways of composing three compatible maps.

Applying One Transformation After Another

A linear transformation can change both the coordinates of a vector and the dimension of the space containing it. If one transformation sends vectors in \(\mathbb{R}^n\) to \(\mathbb{R}^m\), and a second accepts vectors in \(\mathbb{R}^m\), we can feed the first output into the second. This successive application is called composition. To define it correctly, we must keep track of which map acts first and which spaces its inputs and outputs belong to.

A map \(T:\mathbb{R}^n\to\mathbb{R}^m\) is linear if, for all \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\) and all \(a,b\in\mathbb{R}\), it satisfies \(T(a\mathbf{x}+b\mathbf{y})=aT(\mathbf{x})+bT(\mathbf{y})\). In particular, this condition includes preservation of sums and scalar multiples. The space after the arrow is the codomain: it specifies where the map’s outputs are declared to lie, even if the map does not produce every vector in that space.

Definition: Let \(T:\mathbb{R}^n\to\mathbb{R}^m\) and \(S:\mathbb{R}^m\to\mathbb{R}^p\). The composition of \(S\) after \(T\) is the map \(S\circ T:\mathbb{R}^n\to\mathbb{R}^p\) defined by \((S\circ T)(\mathbf{x})=S(T(\mathbf{x}))\) for every \(\mathbf{x}\in\mathbb{R}^n\). The map \(T\) acts first; \(S\) acts second.

The requirement that the codomain of \(T\) be the domain of \(S\) makes \(S(T(\mathbf{x}))\) meaningful for every input \(\mathbf{x}\). The composite’s domain comes from the first map, \(T\), and its codomain comes from the second map, \(S\). Thus the dimensions follow the chain \(\mathbb{R}^n\to\mathbb{R}^m\to\mathbb{R}^p\), giving a composite from \(\mathbb{R}^n\) to \(\mathbb{R}^p\).

Why the Composite Is Linear

Theorem: If \(T:\mathbb{R}^n\to\mathbb{R}^m\) and \(S:\mathbb{R}^m\to\mathbb{R}^p\) are linear, then \(S\circ T:\mathbb{R}^n\to\mathbb{R}^p\) is linear.

Proof. Take any \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\) and \(a,b\in\mathbb{R}\). By the definition of composition and the linearity of \(T\),

$$ (S\circ T)(a\mathbf{x}+b\mathbf{y}) =S\bigl(T(a\mathbf{x}+b\mathbf{y})\bigr) =S\bigl(aT(\mathbf{x})+bT(\mathbf{y})\bigr). $$

The vectors \(T(\mathbf{x})\) and \(T(\mathbf{y})\) belong to \(\mathbb{R}^m\), the domain of \(S\). We can therefore apply the linearity of \(S\) to the last expression:

$$ S\bigl(aT(\mathbf{x})+bT(\mathbf{y})\bigr) =aS(T(\mathbf{x}))+bS(T(\mathbf{y})) =a(S\circ T)(\mathbf{x})+b(S\circ T)(\mathbf{y}). $$

This holds for every \(\mathbf{x},\mathbf{y}\in\mathbb{R}^n\) and every \(a,b\in\mathbb{R}\), so it is exactly the condition that \(S\circ T\) is linear. Its domain and codomain are \(\mathbb{R}^n\) and \(\mathbb{R}^p\) by the definition of composition. \(\square\)

The proof depends on both maps being linear and on their spaces matching. It uses the linearity of \(T\) to simplify the input to \(S\), then uses the linearity of \(S\) to separate the resulting sum and scalars. The conclusion does not assert that the composite reaches every vector in \(\mathbb{R}^p\), or that distinct inputs must have distinct outputs.

Evaluating a Composite in Coordinates

Worked Example: From R² Through R³ to R²

Let \(T:\mathbb{R}^2\to\mathbb{R}^3\) and \(S:\mathbb{R}^3\to\mathbb{R}^2\) be given by \(T(x,y)=(x+y,2x-y,x)\) and \(S(u,v,w)=(u-w,v+w)\). Find \((S\circ T)(x,y)\), then evaluate it at \((2,-1)\).

Each coordinate in these formulas is a linear combination of the input coordinates, so both maps are linear. The output of \(T\) has three coordinates, which supplies the three inputs required by \(S\). Substitute \(u=x+y\), \(v=2x-y\), and \(w=x\) into the formula for \(S\):

$$ \begin{aligned} (S\circ T)(x,y) &=S(x+y,2x-y,x)\\ &=((x+y)-x,(2x-y)+x)\\ &=(y,3x-y). \end{aligned} $$

For \((x,y)=(2,-1)\), first apply \(T\): \(T(2,-1)=(2+(-1),2(2)-(-1),2)=(1,5,2)\). Then apply \(S\): \(S(1,5,2)=(1-2,5+2)=(-1,7)\).

Check: The direct formula gives \((y,3x-y)=(-1,3(2)-(-1))=(-1,7)\), agreeing with the successive calculation. The composite has domain \(\mathbb{R}^2\) and codomain \(\mathbb{R}^2\), since \(T\) starts in \(\mathbb{R}^2\) and \(S\) ends in \(\mathbb{R}^2\).

In a calculation, always apply the right-hand map in \(S\circ T\) first. The notation records function composition, not a left-to-right sequence. Keeping the intermediate vector visible helps catch both order errors and dimension mismatches.

Worked Example: A Composite With a Four-Dimensional Output

Define \(T:\mathbb{R}^3\to\mathbb{R}^2\) and \(S:\mathbb{R}^2\to\mathbb{R}^4\) by \(T(x,y,z)=(x-z,y+2z)\) and \(S(u,v)=(u,v,u+v,2u-v)\). Find the composite formula and evaluate it at \((1,-2,3)\).

Again, every output coordinate is a linear combination of the inputs, so these maps are linear. Since \(T\) outputs two coordinates and \(S\) accepts two inputs, \(S\circ T\) is defined. Substituting \(u=x-z\) and \(v=y+2z\) gives

$$ \begin{aligned} (S\circ T)(x,y,z) &=S(x-z,y+2z)\\ &=(x-z,y+2z,(x-z)+(y+2z),2(x-z)-(y+2z))\\ &=(x-z,y+2z,x+y+z,2x-y-4z). \end{aligned} $$

For the specified input, the first map gives \(T(1,-2,3)=(1-3,-2+2(3))=(-2,4)\). The second map then gives \(S(-2,4)=(-2,4,-2+4,2(-2)-4)=(-2,4,2,-8)\).

Check: Substitution into the composite formula gives \((1-3,-2+6,1-2+3,2-(-2)-12)=(-2,4,2,-8)\). This confirms the computation. The composite is a map \(\mathbb{R}^3\to\mathbb{R}^4\): its input space is inherited from \(T\), and its output space from \(S\).

Composition Along a Longer Chain

When three maps are compatible, either of two groupings can be used: first compose the first two maps and then the third, or first compose the last two and then apply the first. The resulting maps agree, as the next result shows. The parentheses describe how the operations are grouped; they do not change the order in which a particular input passes through the maps.

Theorem (Associativity of composition): Let \(T:\mathbb{R}^n\to\mathbb{R}^m\), \(S:\mathbb{R}^m\to\mathbb{R}^p\), and \(U:\mathbb{R}^p\to\mathbb{R}^q\). Then \((U\circ S)\circ T=U\circ(S\circ T)\) as maps from \(\mathbb{R}^n\) to \(\mathbb{R}^q\).

Proof. Both grouped compositions are defined because the codomain of each map matches the domain of the next. To prove that the maps are equal, take any \(\mathbf{x}\in\mathbb{R}^n\) and evaluate each one. By the definition of composition,

$$ \begin{aligned} ((U\circ S)\circ T)(\mathbf{x}) &=(U\circ S)(T(\mathbf{x}))\\ &=U(S(T(\mathbf{x}))), \end{aligned} $$

while

$$ \begin{aligned} (U\circ(S\circ T))(\mathbf{x}) &=U((S\circ T)(\mathbf{x}))\\ &=U(S(T(\mathbf{x}))). \end{aligned} $$

The outputs agree for every \(\mathbf{x}\in\mathbb{R}^n\), so the two maps are equal. Each maps \(\mathbb{R}^n\) into \(\mathbb{R}^q\), as required. \(\square\)

Worked Example: Tracking a Vector Through Three Maps

Let \(T:\mathbb{R}^2\to\mathbb{R}^3\) be \(T(x,y)=(x,y,x-y)\), let \(S:\mathbb{R}^3\to\mathbb{R}^2\) be \(S(a,b,c)=(a+b,0)\), and let \(U:\mathbb{R}^2\to\mathbb{R}\) be \(U(r,s)=r-s\). Find the output for input \((-1,3)\) using both groupings.

All three maps are linear because each output coordinate is a linear combination of input coordinates. Applying them successively from the right gives \(T(-1,3)=(-1,3,-4)\), \(S(-1,3,-4)=(2,0)\), and \(U(2,0)=2\). Thus \(((U\circ S)\circ T)(-1,3)=2\).

For the other grouping, first apply \(T\) and \(S\), obtaining \((S\circ T)(-1,3)=(2,0)\), and then apply \(U\), giving \((U\circ(S\circ T))(-1,3)=U(2,0)=2\).

Check: The two calculations give the same scalar, \(2\), and both grouped maps have domain \(\mathbb{R}^2\) and codomain \(\mathbb{R}\). In either grouping, the input passes through \(T\), then \(S\), then \(U\).

Codomain, Image, and a Common Error

The codomain of a composite is fixed by the definition: it is the codomain of the outer map. Its actual outputs may occupy only part of that space. For example, in the three-map example, \(S(a,b,c)=(a+b,0)\) always has second coordinate zero. Consequently, \((S\circ T)(x,y)\) always lies on the horizontal axis in \(\mathbb{R}^2\), but \(S\circ T\) is still declared as a map into \(\mathbb{R}^2\). A restricted set of outputs does not by itself change the declared codomain.

Common mistake: carrying forward the intermediate output as the final answer. Let \(T:\mathbb{R}^2\to\mathbb{R}^3\) be \(T(x,y)=(x,y,x+y)\), and let \(S:\mathbb{R}^3\to\mathbb{R}\) be \(S(a,b,c)=a-b\). A wrong calculation at \((1,2)\) might stop after \(T(1,2)=(1,2,3)\) and report that as \((S\circ T)(1,2)\). That vector is only the intermediate output, and it is in the wrong space for the final answer. The correction is to apply \(S\): \(S(1,2,3)=1-2=-1\). Therefore \((S\circ T)(1,2)=-1\), and the composite maps \(\mathbb{R}^2\) to \(\mathbb{R}\).

A related check is to compare the middle spaces before composing. If \(T\) outputs vectors in \(\mathbb{R}^3\), an outer map whose domain is only \(\mathbb{R}^2\) cannot accept \(T(\mathbf{x})\) as an input. The notation \(S\circ T\) is not defined for that pair of maps unless the output of \(T\) lies in the domain of \(S\) as specified.

Check Your Understanding

For each question, keep the intermediate output and the final output spaces distinct.

  1. If \(T:\mathbb{R}^2\to\mathbb{R}^3\) and \(S:\mathbb{R}^3\to\mathbb{R}\), what are the domain and codomain of \(S\circ T\)?
  2. Let \(T(x,y)=(x-y,2x)\) and \(S(a,b)=(a+b,a-b)\). Find \((S\circ T)(x,y)\) and evaluate it at \((1,3)\).
  3. State the condition on the domain and codomain that makes \(S\circ T\) defined for \(T:\mathbb{R}^n\to\mathbb{R}^m\) and \(S:\mathbb{R}^k\to\mathbb{R}^p\).
  4. In a sentence, explain why linearity of both component maps is needed in the proof that their composition is linear.
  5. For three compatible maps \(T,S,U\), write the common input-output expression for \(((U\circ S)\circ T)(\mathbf{x})\) and \((U\circ(S\circ T))(\mathbf{x})\).

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon