Composite Function Calculator & Domain Graph
Build two functions from a line, vertex quadratic, shifted reciprocal or shifted square root. Compare the two orders of composition through their exact intermediate values, real domains and graph intervals. The worksheet keeps the restrictions of the original inner and outer rules at every input.
Compare function compositions
Follow both evaluation orders and see exactly which inputs reach each outer function.
Edit the functions
- f(x)
- √(x − 1)
- g(x)
- x²
f ∘ g
g evaluates first, then f.
√3
≈ 1.732051
g(−2) = 4
Exact domain
(−∞, −1] ∪ [1, ∞)
g ∘ f
f evaluates first, then g.
Undefined
f blocks this input. Input is below 1, so the square root is not real.
Exact domain
[1, ∞)
Composition graph
Filled endpoints belong to the domain. Unfilled endpoints are excluded. The graph window clips the curves and both domain lanes.
Select composition CSV
How to use this calculator
- Open Edit the functions and choose a family for f and g. Enter the scale a, horizontal shift h and vertical shift k for each.
- Enter a probe x. Compare which function evaluates first and what it passes to the outer function.
- Read the exact domain for both orders. Closed brackets include their endpoints. Parentheses exclude them.
- Choose an order to plot and compare the domain lanes. An unfilled point marks an excluded input with a finite two-sided limit.
- Use the removable-hole example to test where a simplified reciprocal composition would appear to give a value.
The Formula
The mathematical logic powering this calculation is:
For a composition f(g(x)), x must lie in the domain of g and g(x) must lie in the domain of f. Swapping the functions changes both checks. The worksheet uses four real families: a(x−h)+k, a(x−h)²+k, k+a/(x−h) and k+a√(x−h), with a ≠ 0. A reciprocal excludes its horizontal shift h; a square root starts at h, including that endpoint.
For an outer reciprocal with shift H, remove each solution of inner(x) = H from the inner domain. For an outer square root, solve inner(x) ≥ H within the inner domain. Write t = (H−k)/a using the inner shift and scale. The linear boundary is h+t. Quadratic boundaries are h±√t where t≥0. Reciprocal equality gives h+1/t when t ≠ 0 and the original inner pole x=h is always excluded. A square-root boundary is h+t² when t≥0. Inequality directions depend on the sign of a and the monotone interval of each branch. A negative t is handled before any squaring. This preserves disjoint intervals, open endpoints and singleton domains.
In a reciprocal of a reciprocal, the excluded original inner input x=h is still undefined. Near that point the inner output diverges, but the outer output tends to its own vertical shift k. The plotted unfilled point records that finite limit. Other inputs that send the inner output to the outer reciprocal's excluded value remain vertical poles. A simplified algebraic expression cannot add an input to the original composition's domain.
Fractions and square-root coefficients are exact. Perfect-square rational radicands reduce to fractions; irrational roots may remain in the entered rational form. At a rational probe, an outer square root of an irrational inner result can retain a nested radical. Exact comparison checks the root and reciprocal gates before evaluating. Graphs sample each allowed component in a finite window, and plotted coordinates use double precision. Enter signed decimals from −10,000 to 10,000 through six places. The graph half-width accepts 0.1 to 1,000 and does not change the exact domain.Worked Example
If you input:
- Function f: √(x−1)
- Function g: x²
- Probe x: −2
Result:
f(g(−2)) = √3, with domain (−∞, −1] ∪ [1, ∞). g(f(−2)) is undefined because the inner square root fails, and its domain is [1, ∞).
Frequently Asked Questions
Which function evaluates first?
Start with the function closest to x. For f(g(x)), evaluate g at x and then evaluate f at that intermediate output.
Why do the domains change when I swap the functions?
Each order checks a different inner domain and a different outer restriction. A quadratic can send both tails to a square root's allowed interval, while putting the square root first may admit only one tail.
Can the domain be just one input?
Yes. For example, a downward-opening quadratic with maximum zero can feed a nonnegative square root only at its vertex.
Why does the graph keep a hole after reciprocals simplify?
An inner reciprocal still divides by zero at its original horizontal shift. The outer output approaches a finite limit there, but the original composition remains undefined.
What does an outer-gate failure mean?
The inner function produced an exact number. That number is outside the domain of the outer function, for example because it equals a reciprocal's horizontal shift.
Does changing the graph window change the solution?
The window controls the displayed axes only. Exact domains and probe calculations remain the same.
Similar Calculators
Inverse Function Calculator & Branch Graph
Find inverse rules and exact preimages for quadratic branches and shifted reciprocal functions. See the graphs reflected across y = x.
Domain and Range from a Graph Calculator
Find the exact domain and range of entered graph segments and points. See open endpoints, interval unions and the vertical-line test.
Piecewise Function Graph Calculator
Graph a piecewise function with open and closed endpoints. Evaluate f(x), compare one-sided limits, and identify gaps, jumps and removable discontinuities.
Simplest Radical Form & Surd Arithmetic Calculator
Simplify square roots and perform exact surd arithmetic. See square-factor extraction, combine matching radicals, and rationalize a two-term denominator with its conjugate.
