Use this free f(g(x)) calculator for linear f and g to get the composition in closed form and evaluated at your x, plus (g∘f)(x), (f+g)(x), (f−g)(x) and (f·g)(x) side by side.

F G X Calculator

Compose and combine two linear functions at any x — closed forms and values, including the reverse composition for contrast.

Free to use Closed form shown All five operations Save PDF · PNG · Share

Enter your values

Fill in the fields below — the result appears with every step shown.

Shown on the printed, PDF and PNG copies of your result. Leave blank to stay anonymous.

Enter a valid value for f(x) = a·x + b — coefficient a.

Enter a valid value for f(x) constant b.

Enter a valid value for g(x) = c·x + d — coefficient c.

Enter a valid value for g(x) constant d.

Enter a valid value for evaluate at x.

Local browser calculation

Review your inputs and the tool’s supported scope before using the result.

Calculator loading… If this message stays, this view is not running the calculator's script — open this file in a full browser tab, then press Calculate.

Your result will appear here

Enter your values above, then press Calculate — or press Enter in any field.
TinyExe F G X Calculator tinyexe.comFree online calculators

TinyExe · F G X Result

Calculated locally in your browser

Calculated on
—

–
—

Name

—

f(x) = a·x + b — coefficient a

—

f(x) constant b

—

g(x) = c·x + d — coefficient c

—

How this was calculated

    What to do next

      TinyExe · tinyexe.com — Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.

      TinyExe PDF & PNG exports carry the TinyExe logo and tinyexe.com header & footer.

      Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.

      Embed this tool

      Add this F G X Calculator to your own page — copy the code below and paste it where you want the tool to appear.

      The embed loads the live calculator in a frame, so it stays up to date automatically. Choose a width, check the code, then copy it. When you publish on WordPress, keep the src pointing at your live tool URL.

      Works in WordPress (Custom HTML block), HTML pages, and most site builders.

      The short answer

      To find f of g of x, substitute the whole expression for g of x into f wherever x appears, then simplify. For f of x equals a x plus b and g of x equals c x plus d, the composition is a c x plus a d plus b.

      • f(g(x)) = acx + (ad + b) for f(x) = ax + b, g(x) = cx + d
      • Composition is not commutative: f(g(x)) ≠ g(f(x)) in general
      • Example: f = 2x + 3, g = x − 4, x = 5 → f(g(5)) = f(1) = 5

      Operations on two functions

      Reference values for this calculator.

      NotationMeaningFor linear f, g — closed form
      (f∘g)(x)f(g(x)) — apply g first, then facx + (ad + b)
      (g∘f)(x)g(f(x)) — usually differentacx + (cb + d)
      (f+g)(x)Add the outputs(a+c)x + (b+d)
      (f−g)(x)Subtract the outputs(a−c)x + (b−d)
      (f·g)(x)Multiply the outputsacx² + (ad+bc)x + bd

      The formula

      The exact formula this calculator uses — every variable in it is explained in the card below.

      The formula

      For f(x) = ax + b and g(x) = cx + d: f(g(x)) = a(cx + d) + b = acx + (ad + b); (f+g)(x) = f(x) + g(x), (f−g)(x) = f(x) − g(x), (f·g)(x) = f(x) × g(x)

      Enhancement: as well as the evaluated composition, the tool returns the composed function in closed form (acx + ad + b), the reverse composition g(f(x)), and the sum, difference and product at the same x — the full set of operations these searches ask for.

      Worked examples

      Worked examples with the full working shown — try them in the calculator to check.

      Example 1

      Textbook pair

      f(x) = 2x + 3, g(x) = x − 4, x = 5

      CalculationSteps
      g(5) = 5 − 4 = 1. f(1) = 2 × 1 + 3 = 5. Closed form: f(g(x)) = 2(x − 4) + 3 = 2x − 5; at x = 5: 5.(f∘g)(5) = 5; (g∘f)(5) = 9 — different, as expected.

      Result

      Example 2

      Identity inner function

      f(x) = 3x − 1, g(x) = x, x = 7

      CalculationSteps
      g(7) = 7, so (f∘g)(7) = f(7) = 3 × 7 − 1 = 20. Composing with the identity changes nothing.(f∘g)(7) = 20, exactly f(7).

      Result

      Example 3

      Negative coefficients

      f(x) = −x + 2, g(x) = 4x + 1, x = −3

      CalculationSteps
      g(−3) = 4 × (−3) + 1 = −11. f(−11) = 11 + 2 = 13. Closed form: −(4x + 1) + 2 = −4x + 1; at x = −3: 13.(f∘g)(−3) = 13; (f·g)(−3) = -55.

      Result

      How to use this calculator

      Step 1

      Enter the coefficients of f(x) = ax + b.

      Step 2

      Enter the coefficients of g(x) = cx + d.

      Step 3

      Enter the x at which to evaluate.

      Step 4

      Read (f∘g)(x) as the headline, with the closed form of the composed function and every other combination in the details.

      In short: Function composition (f∘g)(x) = f(g(x)) applies one function to the output of another; (f+g), (f−g) and (f·g) combine two functions pointwise at the same x.

      Frequently asked questions

      What does (f∘g)(x) mean?

      It means f(g(x)): evaluate g at x first, then feed that result into f. The order matters — (f∘g)(x) and (g∘f)(x) are generally different functions, and this calculator shows both so you can see the asymmetry.

      Why is the tool limited to linear functions?

      The searches behind this page — f(g(x)), (f+g)(x), (f−g)(x) for textbook pairs — are dominated by linear f and g, and the linear case has clean closed forms (acx + ad + b) worth showing exactly. Quadratic and other pairs are handled by the Combination Functions Calculator; this scope is stated openly in the limitations.

      How do I check a composition by hand?

      Substitute the whole of g(x) wherever x appears in f, then simplify: f(g(x)) = a(cx + d) + b = acx + ad + b. Then evaluate at your x and compare with evaluating step by step — both routes must agree, and this calculator shows both.

      What are (f+g)(x) and (f−g)(x)?

      Pointwise combinations: at each x, add (or subtract) the two function values. For linear functions the sum is also linear, (a+c)x + (b+d); the product is not — it is the quadratic acx² + (ad+bc)x + bd.

      Can x be a fraction or negative?

      Yes — any real x works, including negatives and decimals, and the coefficients can be negative or fractional as well.

      About this calculator

      The F G X calculator answers the cluster of homework questions written as (f∘g)(x), f(g(x)), (f+g)(x), (f−g)(x) and (f·g)(x): given two linear functions f and g and a value of x, it computes the composition in both directions and the pointwise sum, difference and product, showing the composed function in closed form as well as its value.

      Composition is substitution with discipline: f(g(x)) means the output of g becomes the input of f. Students often reverse the order or distribute incorrectly; writing f(x) = ax + b and replacing x with the entire (cx + d), brackets included, gives a(cx + d) + b = acx + ad + b. The closed form is linear again — composing two linear functions can never produce a curve — and this calculator displays it so the pattern is visible, not just the number at one x.

      The pointwise operations behave differently. (f+g) and (f−g) stay linear, but (f·g)(x) multiplies the outputs and produces a quadratic, acx² + (ad+bc)x + bd. Seeing all five results for the same pair of functions, side by side at the same x, is the fastest way to keep the notations separate in your head.

      A useful sanity check: evaluating the closed form at your x must match the two-step evaluation (g first, then f). The steps in this tool show both routes arriving at the same number.

      Use it for algebra homework and revision on function operations, to check a hand-worked composition before submitting, or whenever a problem chains two linear models — a conversion followed by a fee, a discount followed by tax — which is exactly a composition.

      How to calculate it yourself

      Step 1

      Write f(x) = ax + b and g(x) = cx + d with their coefficients.

      Step 2

      For f(g(x)), substitute: a(cx + d) + b.

      Step 3

      Expand and simplify to acx + (ad + b).

      Step 4

      Evaluate at the given x — or evaluate g(x) first and then f of that result; both give the same answer.

      Real-life examples

      Discount then tax

      A shop applies a 20% discount modelled by g(price) = 0.8 × price, then a receipts app converts the result to a loyalty-points value with f(v) = 2v + 10. A $50 item goes through the chain.

      (f∘g)(50) = 90 points, from the closed form 1.6x + 10.

      The $50 item earns 90 points after the discount is applied first.

      Temperature conversion chain

      A sensor reports Celsius; a display converts to Fahrenheit with g(C) = 1.8C + 32, and an alarm offset adds a calibration f(F) = F + 2. At 25 °C the chain is a composition.

      (f∘g)(25) = 79 from the closed form 1.8x + 34.

      The display reads 79 after conversion plus calibration.

      Ideas & use cases

      • Order matters demo: pick any pair and compare (f∘g)(x) with (g∘f)(x) in the details — then find the special case (what must be true of the constants?) where they coincide.
      • Identity and inverse spotting: set g(x) = x and watch composition collapse to f; then try g as the inverse of f with small numbers and see (f∘g)(x) return x itself.
      • Closed-form practice: before reading the result, predict ac and ad + b from the coefficients, then check — two multiplications are the whole skill.

      Limitations & sources

      • f and g are linear (ax + b form) only — that is the honest scope of this tool. For a quadratic f use the Combination Functions Calculator. No rational functions, so no domain exclusions from denominators are modelled.

      Sources: Function composition and arithmetic combinations: OpenStax Algebra and Trigonometry 2e, §1.4 (Composition of Functions) and §1.3

      F G X Calculator · TinyExe calculator suite Free to use · No sign-up · Instant results