Calculate f(g(x)) and g(f(x)) with step-by-step solutions. Enter two functions and get the composed result instantly.
Want to solve ANY math problem? Just take a screenshot.
Math.Photos handles algebra, calculus, geometry, statistics, and more — all from a photo or your handwritten notes.
20 free solves · no credit card · no account needed to start
Function composition combines two functions by plugging one into the other. f(g(x)) means "first apply g, then apply f to the result." It's written as (f ∘ g)(x).
Order matters! f(g(x)) applies g first, then f. g(f(x)) applies f first, then g. These usually give different results.
Replace every x in f(x) with the entire expression g(x). Then simplify by expanding and combining like terms.
To find f(g(2)): first compute g(2), then plug that result into f. For example, if g(x) = 2x+1, then g(2) = 5, and f(5) gives your answer.
A calculator gives you an answer. It doesn't tell you which line of your working went wrong. Photograph your own steps — handwritten notebook, whiteboard, or a screenshot of an online assignment — and Math.Photos checks them line by line, then points at the exact step where the sign flipped.
Photo of your notebook, not a retyped expression.
"Line 3 dropped a negative", not just "wrong".
Questions that lead you to the fix, not the answer.
Start free — 20 solves, no card. Upgrade only when you run out.
$1.99 /month
50 solves/month
Enough for a weekly problem set.
$4.99 /month
500 solves/month
Every assignment, all semester, plus Teach Me mode.
$9.99 /month
3,000 solves/month
Multi-device sync and LaTeX/PDF export.
Annual billing saves 37%. Cancel anytime — see full plan comparison.
Math.Photos solves any math problem from a screenshot — algebra, calculus, geometry, statistics, and more. With step-by-step explanations.
Install20 free solves · no credit card
To find f(g(x)): (1) Write out f(x) and g(x), (2) Wherever you see x in f(x), replace it with the entire expression for g(x), (3) Expand and simplify. For example, if f(x) = x² + 1 and g(x) = 2x + 3, then f(g(x)) = (2x+3)² + 1 = 4x² + 12x + 10.
No. Function composition is not commutative. f(g(x)) and g(f(x)) usually give different results. For example, if f(x) = x² and g(x) = x + 1, then f(g(x)) = (x+1)² = x² + 2x + 1, but g(f(x)) = x² + 1.
The domain of f(g(x)) is all x values in the domain of g where g(x) is in the domain of f. You must check both conditions.
First compute g at that value, then plug the result into f. For f(g(2)) with f(x) = x² and g(x) = 3x: g(2) = 6, then f(6) = 36.