Example Data Table
| f(x) |
g(x) |
x |
f(g(x)) |
g(f(x)) |
| x^2 + 2*x + 1 |
3*x - 4 |
2 |
9 |
23 |
| sqrt(x + 5) |
x^2 - 1 |
3 |
sqrt(13) |
about 1.828 |
| sin(x) |
2*x |
1 |
sin(2) |
2*sin(1) |
Formula Used
The composition of two functions places one function inside another function.
f(g(x)) = f evaluated at the value returned by g(x).
g(f(x)) = g evaluated at the value returned by f(x).
The calculator first evaluates the inner function. Then it sends that result into the outer function. The difference is calculated as f(g(x)) minus g(f(x)). The derivative estimate uses the central difference formula.
Differential estimate = [C(x + h) - C(x - h)] / (2h)
How to Use This Calculator
- Enter the first function in the f(x) field.
- Enter the second function in the g(x) field.
- Enter the x value for direct evaluation.
- Set the table range and step size.
- Choose radians or degrees for trigonometric functions.
- Press Calculate to show results above the form.
- Use CSV for spreadsheet work.
- Use PDF for a compact export.
You can use operators +, -, *, /, and ^. Supported functions include sin, cos, tan, asin, acos, atan, sqrt, abs, ln, log, log10, exp, floor, ceil, and round. Constants pi and e are also supported.
About This Composition Calculator
Function composition links two rules in a chosen order. It sends a value into one function first. The answer then becomes the input for the second function. This calculator helps you test both common orders. You can evaluate f(g(x)) and g(f(x)) with one submission. It also compares both outputs, so order changes become visible. That matters because composition is usually not commutative.
Why Composition Matters
Many real problems use stages. A cost rule may depend on quantity. A tax rule may depend on cost. A scale rule may follow a measurement rule. Composition keeps these steps in the right sequence. In algebra, it also helps reveal domains, inverse behavior, and nested transformations. When the inner function produces a restricted value, the outer function must still accept that value.
Advanced Checks Included
The calculator accepts common operators and functions. You may use powers, roots, trigonometric functions, logarithms, absolute values, constants, and grouped terms. It evaluates the selected value. It also builds a sample table over a range. The table is useful for spotting undefined points, steep changes, and order differences. A central difference estimate is included for both composed forms. This gives a quick numerical slope near the selected value.
Reading The Results
The result panel shows f(x), g(x), f(g(x)), and g(f(x)). It also shows the difference between the two compositions. A zero difference at one value does not prove both compositions are equal everywhere. It only means they match at that input. Use the table to compare more values. For a proof, simplify the symbolic forms by hand or with a computer algebra system.
Best Practice
Write multiplication clearly with an asterisk. For example, enter 3*x instead of 3x. Use parentheses when nesting expressions. Check the domain before trusting any result. Square roots need nonnegative inputs. Logarithms need positive inputs. Denominators cannot be zero. Export the table when you need a record for class notes, reports, or later checking.
Helpful Export Workflow
After calculation, choose CSV for spreadsheets. Choose PDF for a compact summary. CSV is best for sorting values. PDF is best for sharing a fixed result. Keep the same formulas in your notes, so every exported row can be checked later with confidence again.
FAQs
What is function composition?
Function composition means using the output of one function as the input of another. For f(g(x)), g is evaluated first. Then its result is placed into f.
Are f(g(x)) and g(f(x)) always equal?
No. Function composition usually depends on order. The two results may match at one value, but that does not prove they are identical for every value.
Can I use trigonometric functions?
Yes. You can use sin, cos, tan, asin, acos, and atan. Choose radians or degrees from the angle mode field before calculating.
Why does the calculator show undefined?
An undefined result may happen because of division by zero, a negative square root, an invalid logarithm, or a restricted inverse trigonometric input.
Does this simplify symbolic expressions?
No. This calculator focuses on numeric evaluation, comparison, derivatives, and tables. It helps check values, but it does not produce formal symbolic simplification.
How should I enter multiplication?
You may enter 3*x for clear multiplication. The calculator also supports simple implicit multiplication, such as 2x or 2(x+1), but explicit notation is safer.
What does the derivative estimate mean?
It estimates the slope of the composed function near the selected x value. It uses a central difference method, not a symbolic derivative.
What is the CSV export for?
The CSV export saves the generated values in a spreadsheet-friendly format. It is useful for assignments, checking patterns, or keeping calculation records.