Why Composition Needs Its Own Concavity Check
A composite function \(h(x)=f(g(x))\) applies one function and then another. Even if the concavity of \(f\) is known, that information alone does not determine the concavity of \(h\). The input to \(f\) is changing according to \(g\), and that change can itself have curvature.
The second derivative records both effects. One term reflects the curvature of the outer function \(f\), while another reflects the curvature of the inner function \(g\). Depending on their signs and sizes, these effects can reinforce one another or oppose one another.
Concavity and the Second Derivative
On an interval, a function is concave upward (or convex) if its graph bends upward, and concave downward if its graph bends downward. For a twice-differentiable function on an interval, \(h''(x)\ge 0\) throughout the interval implies that \(h\) is concave upward there; \(h''(x)\le 0\) implies that \(h\) is concave downward. Strict inequalities throughout give strict concavity in the corresponding direction.
To apply this test to \(h=f\circ g\), first check that the composition is defined on the interval under consideration, and that \(g(x)\) lies in the domain of \(f\). Then use the second-derivative formula and determine the sign of the entire sum. It is not enough to inspect just one of its terms.
Deriving the Composite Second-Derivative Formula
The formula follows by applying the chain rule twice. Write \(h(x)=f(g(x))\). The first derivative is \(h'(x)=f'(g(x))g'(x)\). Differentiating this product gives the second derivative.
By the chain rule, \(h'(x)=f'(g(x))g'(x)\).
The product rule gives \(h''(x)=\bigl(f'(g(x))\bigr)'g'(x)+f'(g(x))g''(x)\).
\(\bigl(f'(g(x))\bigr)'=f''(g(x))g'(x)\), so \(h''(x)=f''(g(x))(g'(x))^2+f'(g(x))g''(x)\).
This derivation requires the relevant derivatives to exist: \(g\) must be twice differentiable at \(x\), and \(f\) must be twice differentiable at \(g(x)\). The formula shows why \(f''\) alone is insufficient: even if \(f''(g(x))\) has a fixed sign, the second term can change the sign of the sum.
Reading the Two Contributions
The first contribution, \(f''(g(x))(g'(x))^2\), uses the curvature of \(f\) at the input \(g(x)\). Since \((g'(x))^2\ge 0\), this term has the sign of \(f''(g(x))\) whenever \(g'(x)\ne 0\), and it is zero when \(g'(x)=0\).
The second contribution, \(f'(g(x))g''(x)\), combines the slope of \(f\) at \(g(x)\) with the curvature of \(g\). Its sign depends on both factors. For example, if \(f'\) is positive and \(g''\) is positive, this term is positive; if \(f'\) is negative and \(g''\) is positive, it is negative.
These observations help organize the calculation, but the final decision always comes from adding the two contributions. In particular, a concave-down outer function does not guarantee a concave-down composition. The second contribution may be positive and large enough to outweigh the first.
Worked Example: A Logarithm of a Curved Input
Worked Example: Determine the concavity of \(\ln(x^2+1)\)
Let \(h(x)=\ln(x^2+1)\). Set \(f(u)=\ln u\) and \(g(x)=x^2+1\). The inner function satisfies \(g(x)\ge 1\), so it always lies in the domain \(u>0\) of the logarithm.
Differentiate the outer function with respect to \(u\): $$ f'(u)=\frac{1}{u}, \qquad f''(u)=-\frac{1}{u^2}. $$ Differentiate the inner function: $$ g'(x)=2x, \qquad g''(x)=2. $$ Substitute into the composite formula: $$ \begin{aligned} h''(x) &= -\frac{1}{(x^2+1)^2}(2x)^2+\frac{1}{x^2+1}(2)\\ &= -\frac{4x^2}{(x^2+1)^2}+\frac{2(x^2+1)}{(x^2+1)^2}\\ &= \frac{2-2x^2}{(x^2+1)^2}\\ &= \frac{2(1-x^2)}{(x^2+1)^2}. \end{aligned} $$ The denominator is positive for every real \(x\). The numerator is positive when \(-1<x<1\), zero at \(x=\pm1\), and negative when \(x<-1\) or \(x>1\). Therefore \(h\) is concave upward on \((-1,1)\) and concave downward on \((-\infty,-1)\) and \((1,\infty)\).
At each of \(x=-1\) and \(x=1\), the sign of \(h''\) changes, so each is an inflection point. Since \(h(\pm1)=\ln 2\), their coordinates are \((-1,\ln 2)\) and \((1,\ln 2)\).
Check: Direct differentiation gives \(h'(x)=2x/(x^2+1)\). Differentiating this quotient yields $$ h''(x) =\frac{2(x^2+1)-4x^2}{(x^2+1)^2} =\frac{2(1-x^2)}{(x^2+1)^2}, $$ which agrees with the composite formula.
Worked Example: A Concave Outer Function Can Produce a Convex Composition
Worked Example: Determine the concavity of \(\sqrt{x^2+1}\)
Let \(h(x)=\sqrt{x^2+1}\), with \(f(u)=\sqrt{u}\) and \(g(x)=x^2+1\). Since \(g(x)\ge 1\), the square root is defined for every real \(x\). For \(u>0\), $$ f'(u)=\frac{1}{2\sqrt{u}}, \qquad f''(u)=-\frac{1}{4u^{3/2}}. $$ Also, \(g'(x)=2x\) and \(g''(x)=2\). Thus $$ \begin{aligned} h''(x) &= -\frac{1}{4(x^2+1)^{3/2}}(2x)^2 +\frac{1}{2\sqrt{x^2+1}}(2)\\ &= -\frac{x^2}{(x^2+1)^{3/2}} +\frac{x^2+1}{(x^2+1)^{3/2}}\\ &= \frac{1}{(x^2+1)^{3/2}}. \end{aligned} $$ This is positive for every real \(x\). Therefore \(h\) is concave upward on all of \(\mathbb{R}\), even though \(f(u)=\sqrt{u}\) is concave downward for \(u>0\).
Check: Differentiating \(h(x)=\sqrt{x^2+1}\) directly gives \(h'(x)=x/\sqrt{x^2+1}\). Differentiating again, $$ h''(x) =\frac{1}{\sqrt{x^2+1}}-\frac{x^2}{(x^2+1)^{3/2}} =\frac{1}{(x^2+1)^{3/2}}, $$ as obtained from the formula.
A Common Mistake: Ignoring the Inner Curvature
In the square-root example, one might look only at \(f''(u)<0\) and conclude that the composition must be concave downward. That reasoning would keep only the first term: $$ f''(g(x))(g'(x))^2 =-\frac{x^2}{(x^2+1)^{3/2}}\le 0. $$ But this is not the full second derivative. The omitted term is $$ f'(g(x))g''(x) =\frac{1}{\sqrt{x^2+1}}>0. $$ Adding the terms gives \(h''(x)=1/(x^2+1)^{3/2}>0\), so the composition is concave upward. The correction is to include both terms before deciding the sign.
Worked Example: Concavity That Changes Across the Real Line
Worked Example: Determine the concavity of \(e^{-x^2}\)
Let \(h(x)=e^{-x^2}\), with \(f(u)=e^u\) and \(g(x)=-x^2\). Both functions are twice differentiable for all real inputs. The outer derivatives are \(f'(u)=e^u\) and \(f''(u)=e^u\); the inner derivatives are \(g'(x)=-2x\) and \(g''(x)=-2\). Therefore $$ \begin{aligned} h''(x) &=e^{-x^2}(-2x)^2+e^{-x^2}(-2)\\ &=e^{-x^2}(4x^2-2)\\ &=2e^{-x^2}(2x^2-1). \end{aligned} $$ Since \(e^{-x^2}>0\), the sign is determined by \(2x^2-1\). This expression is positive when \(|x|>1/\sqrt{2}\), zero when \(x=\pm1/\sqrt{2}\), and negative when \(|x|<1/\sqrt{2}\). Hence \(h\) is concave upward on \((-\infty,-1/\sqrt{2})\) and \((1/\sqrt{2},\infty)\), and concave downward on \((-1/\sqrt{2},1/\sqrt{2})\).
The sign changes at both boundary points, so both are inflection points. Their function values are \(e^{-1/2}\), giving coordinates \((-1/\sqrt{2},e^{-1/2})\) and \((1/\sqrt{2},e^{-1/2})\).
Check: The first derivative is \(h'(x)=-2xe^{-x^2}\). Differentiating by the product rule gives $$ h''(x)=-2e^{-x^2}+4x^2e^{-x^2} =e^{-x^2}(4x^2-2), $$ matching the result from the composite formula.
A Reliable Sign-Checking Procedure
When assessing a composite function, keep the domain and the two contributions visible. A useful procedure is:
Write \(h=f\circ g\), and check that \(g(x)\) belongs to the domain of \(f\) on the interval being studied.
Compute \(f'\), \(f''\), \(g'\), and \(g''\), taking care to evaluate the outer derivatives at \(g(x)\).
Use \(h''=f''(g)(g')^2+f'(g)g''\); do not discard a term because it seems secondary.
Factor or simplify when possible, then identify where \(h''\) is positive, negative, or zero.
Use the sign of \(h''\) on each interval. A zero of \(h''\) is an inflection point only when the concavity changes there and the function is defined continuously at that point.
When Concavity Is Preserved
The formula also explains some useful special cases. If \(g\) is linear, then \(g''(x)=0\), so the second contribution disappears. In that case, $$ (f\circ g)''(x)=f''(g(x))(g'(x))^2. $$ Because the squared factor is nonnegative, a concave-down \(f\) produces a concave-down composition wherever the formula applies, and a concave-up \(f\) produces a concave-up composition. If \(g\) is not linear, the term \(f'(g(x))g''(x)\) remains and can alter the result.
More generally, the sign of the composition is determined by the balance between the two terms, not by a single label attached to \(f\) or \(g\). This is why computing the composite second derivative is more reliable than relying on a visual intuition that the composition should “inherit” the outer function’s curvature.
Check Your Understanding
Use the composite second-derivative formula in each question, and state any domain conditions that matter.
- For \(h(x)=\ln(1+x^2)\), which two terms contribute to \(h''(x)\), and where does its concavity change?
- Why does knowing that \(f''(g(x))<0\) not by itself prove that \(f(g(x))\) is concave downward?
- If \(g\) is linear and \(g'(x)\ne 0\), how does the sign of \((f\circ g)''(x)\) relate to the sign of \(f''(g(x))\)?
- For \(h(x)=e^{-x^2}\), what determines the sign of \(h''(x)\) after the positive exponential factor is removed?
- What additional fact, beyond \(h''(c)=0\), is needed to conclude that \(c\) is an inflection point?