DGS Studio

Functions & Inverses

Function Composition

Apply functions from right to left and preserve domain restrictions.

f(x)=x^2+1, g(x)=2*x, (f∘g)(x) means f(g(x))=(2*x)^2+1=4*x^2+1. Both functions and this composition have all real inputs.

The numeric version at 3 returns 37. The three-function example (f∘g∘h)(x), with f(x)=x+1, g(x)=2*x and h(x)=x^2, returns 2*x^2+1. Use Equations for the exact simplification or Graph to compare the original functions and the composition.

Equation

f(x)=x^2+1, g(x)=2*x, (f∘g)(x)

Substitution order and domains

Composition applies the rightmost function first. To form f(g(x)), substitute the whole expression g(x) for every occurrence of the input in f. Parentheses matter: squaring 2*x gives 4*x^2, not 2*x^2. The symbol ∘ and nested function calls describe the same operation, and changing their order can change the answer.

The input must belong to the inner function's domain, and the inner output must belong to the outer function's domain. Simplification cannot remove an original hole or make a forbidden square root real. The equation workflow reports the symbolic expression and substitution steps. The graph workflow compares the functions and their composition on their valid domains.

Reading the input

Other versions of this example

These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.

Symbolic composition

This is a command. The name selects the routine, and the items inside the parentheses are its arguments.

f(x)=x^2+1, g(x)=2*x, (f∘g)(x)

Numeric composition

This is a command. The name selects the routine, and the items inside the parentheses are its arguments.

f(x)=x^2+1, g(x)=2*x, (f∘g)(3)

Three functions

This is a command. The name selects the routine, and the items inside the parentheses are its arguments.

f(x)=x+1, g(x)=2*x, h(x)=x^2, (f∘g∘h)(x)

Try a change

Solve Equation opens the original input in the equation workspace and displays its symbolic results, conditions, and solution steps.

Edit and generate

Solve Equation opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples