Substitute the whole inside expression
Before filling a form with letters, run the two machines with numbers. Let g multiply by 3 and add 2, and let f square its input and subtract 6. Input 0 goes to 2 and then −2. Input 1 goes to 5 and then 19. Input 2 goes to 8 and then 58. A formula records all these trips at once. Each input letter in the outer rule is a blank on the form. Put the whole inner expression into every blank. Parentheses hold its pieces together until you multiply and combine them. This replacement is substitution. You can run the same rule twice or connect three rules with the same method.
- Distribution. 2(x − 4) = 2x − 8, because the factor multiplies both terms.
- Expanding a square. (x + 1 = + x + x + 1 = + 2x + 1.
- Subtracting a package. −(x + 2) = −x − 2.
- Like terms. 2x + 2x = 4x, while and x are different kinds of terms.
- Nonzero denominator. 2x − 1 ≠ 0 means x ≠ .
- Composition order. f(g(x)) replaces the input slots in f with g(x), not the other way around.
- Multiplying powers. x × = x × (x × x) = . The exponent counts three multiplied copies of x.
(a + b = + 2ab + , because (a + b)(a + b) has two cross products ab.
f of g of x; replace every outer input with the whole inner expression
The outer formula acts on the entire expression produced by the inner formula.
- f(g(x)) = (3x + 2 − 6
- (f ∘ g)(x) = 9 + 12x − 2
- f(u) = − 6: u is the outer input place
Put the same wrapped package into every blank on a form.
The outer formula − x has two boxes. If the inner output is x + 2, fill both boxes with that package: (x + 2 − (x + 2).
Parentheses are the wrapper. A square outside the wrapper applies to every part of the input. A minus outside the wrapper subtracts every part.
Squaring 3x + 2 places that same group along both rectangle sides. Four products fill it: 9, 6x, 6x, and 4. Both middle rectangles contribute, so their total is 12x.
At x = 1, the inner expression 3x + 2 gives 5, whose square is 25. The expansion gives 9 + 12 + 4 = 25. Dropping the middle term gives 13, so this test catches that mistake.
.1A linear outside formula
If the outer function multiplies its input by a number, that number multiplies the whole inner expression. Put in the package first, then distribute.
- For f(x) = 3x and g(x) = x − 4, f(g(x)) = 3(x − 4).
Let f(x) = 3x and g(x) = x − 4. Find f(g(x)). You want to triple the entire g output. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = f(x − 4) = 3(x − 4).The outer input slot receives x − 4.
- = 3x − 12.3 multiplies x and −4.
- Draw one multiplication arrow from the outside factor to each term inside.
.2A square outside formula
A square means multiplying the input by itself. If the input is a sum, both copies of the whole sum must be multiplied. The middle term comes from two cross products.
- (x + 1 = + 2x + 1.
- A square does not distribute over addition.
Let f(x) = and g(x) = x + 1. Find f(g(x)). You want to square the complete inner output. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = (x + 1 = (x + 1)(x + 1).Squaring multiplies the whole input by itself.
- = + x + x + 1 = + 2x + 1.The four products include two matching middle terms.
- Multiply two written copies if the square formula is hard to remember.
.3A fraction outside formula
A fraction's denominator may also contain an input slot. Replace that slot with the complete inner expression. Then check when the new denominator would be zero.
- For f(x) = , f(g(x)) = .
- The original and intermediate restrictions still matter; the next lesson develops both gates.
Let f(x) = and g(x) = 3x + 1. Find f(g(x)). You want to subtract 2 from the g output, then take the reciprocal. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = .The whole inner expression replaces x in the denominator.
- = .The constants 1 − 2 combine to −1.
- Find the forbidden starting input by solving 3x − 1 = 0: add 1 to get 3x = 1, then divide by 3 to get x = . Check: 3 × − 1 = 0. Exclude that input.This finds and confirms the one start that makes the new denominator zero. The inner linear function itself accepts every real input.
- Copy the entire fraction first, then replace its input places.
.4Compose a function with itself
A machine can send its answer back through the same rule. The second trip uses the first answer as its input. In j(j(x)), the two j names mean two separate applications of the same instructions. This operation is different from multiplying the first answer by itself.
- (j ∘ j)(x) = j(j(x)).
- j(j(x)) uses the output as a new input; j(x squares the output instead.
Let j(x) = 4x + 5. Find j(j(x)) and its value at x = 1. You run j twice, using a new input the second time. Plan: put the whole first output 4x + 5 into j, distribute 4, and check with two separate number evaluations.
- j(j(x)) = 4(4x + 5) + 5.The outer copy of j receives 4x + 5 as its whole input.
- = 16x + 20 + 5 = 16x + 25.Distribution multiplies both inner terms by 4, then combines the added constants.
- At x = 1, j(j(1)) = 16 × 1 + 25 = 41.The composed formula gives the final output for starting input 1.
- j(j(x)) = 16x + 25.
- j(j(1)) = 41.
- Know cold: same name means same instructions again, with a new input.
.5Connect three functions
Think of three stations in a kitchen. The first prepares something for the second, and the second prepares something for the third. In p(q(v(x))), v acts first, q second, and p last. Each completed answer replaces the next input. More functions mean more stages, while the inside-first method stays the same.
- p(q(v(x))) runs v, then q, then p.
- A chain is defined only when every stage accepts the answer handed to it.
Let v(x) = x + 3, q(x) = , and p(x) = 2x − 7. Find p(q(v(2))) and p(q(v(x))). You run three jobs, starting with the deepest parentheses. Plan: add 3, square the result, then double and subtract 7.
- v(2) = 2 + 3 = 5.v touches the starting input, so it acts first.
- q(v(2)) = q(5) = 25.The output 5 is now the input to the square.
- p(q(v(2))) = p(25) = 2 × 25 − 7 = 43.The final rule receives 25, rather than the original 2.
- p(q(v(x))) = 2(x + 3 − 7.The inner expression is squared in full and handed to the last rule.
- (x + 3 = + 3x + 3x + 9 = + 6x + 9.All four products belong to the square.
- 2( + 6x + 9) − 7 = 2 + 12x + 18 − 7 = 2 + 12x + 11.The outside factor multiplies each term, then the constants combine.
- p(q(v(2))) = 43.
- p(q(v(x))) = 2 + 12x + 11.
- Write one line for every function, starting with the innermost parentheses.
- 1. Copy the outer formula and identify every input slot.
- 2. Write the complete inner formula in parentheses in every slot.
- 3. Keep powers outside those parentheses so they act on the entire input.
- 4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
- 5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.
Build one formula for a composition
- 1. Copy the outer formula and identify every input slot.
- 2. Write the complete inner formula in parentheses in every slot.
- 3. Keep powers outside those parentheses so they act on the entire input.
- 4. Expand with distribution. For a square, multiply the two identical parentheses and keep both cross products.
- 5. Combine like terms, preserve any domain restrictions, and check a small allowed input by the two-stage route.
Let f(x) = − 6 and g(x) = 3x + 2. Find (f ∘ g)(x) and (g ∘ f)(x). You want one formula for each order. Plan: put the complete inner formula into the outer input place, multiply out any square using four products, and collect matching terms.
- (f ∘ g)(x) = f(3x + 2) = (3x + 2 − 6.The outer f squares its whole input before subtracting 6.
- (3x + 2 = (3x + 2)(3x + 2) = 9 + 6x + 6x + 4.Each of the two terms in one copy multiplies each term in the other copy.
- (f ∘ g)(x) = 9 + 12x + 4 − 6 = 9 + 12x − 2.The two middle products add to 12x, and 4 − 6 = −2.
- (g ∘ f)(x) = g( − 6) = 3( − 6) + 2.Now g multiplies f’s entire output by 3 and adds 2.
- (g ∘ f)(x) = 3 − 18 + 2 = 3 − 16.The factor 3 multiplies both and −6, then −18 + 2 = −16.
- (f ∘ g)(x) = 9 + 12x − 2.
- (g ∘ f)(x) = 3 − 16.
- Both domains are all real numbers.
Let g(x) = 4 and f(x) = x + 1. Find f(g(x)). Whatever input you start with, the first machine returns 4. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = f(4).The inner output is always 4.
- f(4) = 4 + 1 = 5.The outer function adds 1 to its input.
Let f(x) = 2x + 3 and g(x) = x − 4. Find f(g(x)). You want to double the complete inner answer and add 3. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = 2(x − 4) + 3.x − 4 replaces the outer input slot.
- = 2x − 8 + 3 = 2x − 5.Distribute 2 and then combine the constants.
Let f(x) = − x and g(x) = x + 2. Find f(g(x)). You must use the whole g output twice. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = (x + 2 − (x + 2).Both occurrences of the outer input receive x + 2.
- = + 2x + 2x + 4 − x − 2.Multiplying the square produces four terms, and subtracting the last package changes both signs.
- = + 3x + 2.4x − x = 3x and 4 − 2 = 2.
Let f(x) = + 1 and g(x) = 3x − 2. Find f(g(x)). You want to square the whole difference and then add 1. Plan: wrap the inner expression in parentheses in every outer input place, then distribute and collect matching terms.
- f(g(x)) = (3x − 2 + 1.The square acts on all of g's output.
- (3x − 2 = 9 − 6x − 6x + 4.Each cross product contains one negative factor, while (−2)(−2) is positive.
- f(g(x)) = 9 − 12x + 5.The cross products add to −12x and 4 + 1 = 5.
Let f(x) = and g(x) = 2x. Find f(g(x)). You replace the input on both top and bottom. Plan: put 2x into both places, then find the starting input that makes the entire denominator zero.
- f(g(x)) = .Each x slot in f receives the full expression 2x.
- Solve 2x − 1 = 0 to locate the forbidden input: 2x = 1, so x = . Plug it back in: 2 × − 1 = 0. Exclude .The denominator must not be zero. This equation finds the starting input at which that failure would occur; g itself has no restrictions.
Let j(x) = 4x + 5. Find j(j(x)) and its value at x = 1. You run j twice, using a new input the second time. Plan: put the whole first output 4x + 5 into j, distribute 4, and check with two separate number evaluations.
- j(j(x)) = 4(4x + 5) + 5.The outer copy of j receives 4x + 5 as its whole input.
- = 16x + 20 + 5 = 16x + 25.Distribution multiplies both inner terms by 4, then combines the added constants.
- At x = 1, j(j(1)) = 16 × 1 + 25 = 41.The composed formula gives the final output for starting input 1.
- j(j(x)) = 16x + 25.
- j(j(1)) = 41.
Let v(x) = x + 3, q(x) = , and p(x) = 2x − 7. Find p(q(v(2))) and p(q(v(x))). You run three jobs, starting with the deepest parentheses. Plan: add 3, square the result, then double and subtract 7.
- v(2) = 2 + 3 = 5.v touches the starting input, so it acts first.
- q(v(2)) = q(5) = 25.The output 5 is now the input to the square.
- p(q(v(2))) = p(25) = 2 × 25 − 7 = 43.The final rule receives 25, rather than the original 2.
- p(q(v(x))) = 2(x + 3 − 7.The inner expression is squared in full and handed to the last rule.
- (x + 3 = + 3x + 3x + 9 = + 6x + 9.All four products belong to the square.
- 2( + 6x + 9) − 7 = 2 + 12x + 18 − 7 = 2 + 12x + 11.The outside factor multiplies each term, then the constants combine.
- p(q(v(2))) = 43.
- p(q(v(x))) = 2 + 12x + 11.
- Know cold: every slot gets the whole package. Circle each input-variable occurrence before replacing it.
- Understand, then rebuild: the expanded formula. Parentheses and distribution can recreate it; memorizing the numbers in front of its variable terms is unnecessary.
- Use x = 1 to check for a missing middle term. At x = 0 that term becomes zero and may hide the error.