Calculator
Supported items include x, pi, e, +, -, *, /, ^, parentheses, sin, cos, tan, asin, acos, atan, sqrt, log, ln, log10, abs, exp, floor, and ceil.
Use explicit multiplication, such as 2*x instead of 2x.
Example Data Table
| f(x) |
g(x) |
x |
f(g(x)) |
g(f(x)) |
| x^2 + 1 |
3*x - 4 |
5 |
122 |
74 |
| sqrt(x + 9) |
x / 2 |
8 |
3.605551 |
2.061553 |
| log(x) |
exp(x) |
2 |
2 |
2 |
Formula Used
For two functions f and g, the composition f(g(x)) means:
f(g(x)) = f applied to the value produced by g(x)
The reverse composition is:
g(f(x)) = g applied to the value produced by f(x)
This calculator first evaluates the inner function. It then sends that answer into the outer function. Domain checks are applied during evaluation.
How to Use This Calculator
- Enter the first rule in the f(x) field.
- Enter the second rule in the g(x) field.
- Type the x value you want to test.
- Select one composition order or compare both.
- Choose radians or degrees for trigonometric functions.
- Press Calculate to view the result above the form.
- Use CSV or PDF when you need a saved copy.
Understanding Function Composition
Function composition joins two rules into one process. One function accepts the output of another function. The order matters. The expression f(g(x)) means g runs first, then f uses that result. The expression g(f(x)) reverses the path. This calculator helps compare both paths, so errors become easier to spot.
Why Composition Matters
Composition appears in algebra, modeling, coding, finance, science, and everyday conversion chains. A tax formula may use a discounted price. A physics formula may use a converted unit. A spreadsheet may pass one calculated value into another cell rule. When the inner result is outside the outer function domain, the final answer is not valid. That is why checking intermediate values is important.
Advanced Inputs
The form accepts powers, parentheses, decimals, constants, and common functions. Use x as the variable. Write multiplication with an asterisk. For example, enter 2*x+3 instead of 2x+3. You can evaluate f after g, g after f, or both orders together. The calculator also reports f(x), g(x), inner values, final values, and plain composition strings.
Reading the Output
Start with the selected order. Then review the inner value. If that value is undefined, the final result will also fail. Next, check the composed rule. It shows how the inner expression replaces x in the outer expression. This is not always a simplified algebraic form. It is a clear substitution form for review and teaching.
Practical Use
Use the export buttons when you need records for homework, tutoring, or reports. The CSV file is useful for spreadsheets. The PDF file is useful for sharing a clean result. Always compare the result with the original domain rules. A square root needs a nonnegative input. A logarithm needs a positive input. Division cannot use zero. These checks keep the answer meaningful.
Best Practices
Keep expressions small at first. Test one value before changing many inputs. Use parentheses whenever the order may be unclear. Record units in your notes when functions represent measurements. If a result seems surprising, test f and g separately. That habit reveals whether the issue is the inner rule, the outer rule, or the selected composition order. Then revise safely with confidence.
FAQs
What is a composition of functions?
It is a combined rule where one function uses another function’s output. In f(g(x)), g is evaluated first. Then f uses the result from g.
Does order matter in composition?
Yes. f(g(x)) and g(f(x)) usually give different answers. They match only for special function pairs or specific input values.
Can I use trigonometric functions?
Yes. You can use sin, cos, tan, asin, acos, and atan. Select radians or degrees before calculating the composition.
Why did I get a domain error?
A domain error appears when an input breaks a rule. Examples include square root of a negative number, log of zero, or division by zero.
Does the calculator simplify expressions?
It shows substitution form and evaluates the numeric result. It does not fully simplify algebraic expressions into the shortest symbolic form.
How should I write multiplication?
Use an asterisk for multiplication. Write 2*x, 4*(x+1), or x*(x-3). Do not write 2x or 4(x+1).
What can I export?
You can export entered functions, x value, intermediate values, composition rules, and final answers. CSV is useful for sheets. PDF is useful for sharing.
Can I compare both orders at once?
Yes. Choose the both orders option. The calculator will show f(g(x)) and g(f(x)) together for easy comparison.