Why Take the Logarithm of an Objective?
A positive objective can contain several factors, each raised to a power. Differentiating the product directly may create long expressions, especially when an exponent also depends on the variable. Taking the logarithm can turn products into sums and powers into coefficients or simpler variable-dependent terms.
This is more than an algebraic convenience. Because the natural logarithm is strictly increasing, maximizing a positive objective is equivalent to maximizing its logarithm. The location of a maximum is preserved, while the derivative calculation may become substantially simpler.
When the Transformation Is Valid
The natural logarithm \(\ln y\) is defined for \(y>0\). Therefore, before replacing \(F\) by \(\ln F\), check that the objective is positive at every point in the domain being considered. For products involving real powers, also check that the bases are positive wherever those powers are defined.
For example, if \(a(x)>0\), \(b(x)>0\), and \(r,s\) are real constants, then
is positive, and the logarithm laws give
The product has become a sum, and constant powers have become coefficients. If the exponent depends on \(x\), the corresponding rule is \(\ln(a(x)^{q(x)})=q(x)\ln a(x)\), provided \(a(x)>0\). The exponent remains inside the resulting expression as a factor.
Why the Critical-Point Equations Agree
Suppose \(F\) is positive and differentiable on an open interval. Define \(G(x)=\ln F(x)\). The chain rule gives the central identity:
Since \(F(x)>0\), the denominator is never zero. Consequently, at an interior point \(c\),
This proves that solving the derivative equation for the logarithm finds exactly the same interior critical points as differentiating the original objective. It also shows that \(F'(x)=F(x)G'(x)\), so \(F'\) and \(G'\) have the same sign wherever \(F>0\). Thus, a sign analysis of the logarithm's derivative also describes whether the original objective is increasing or decreasing.
Worked Example: A Product with Fixed Powers
Worked Example: Maximizing \(x^2(1-x)^3\)
Find the maximum of \(F(x)=x^2(1-x)^3\) for \(0\le x\le1\). The function is positive on \(0<x<1\), so take its logarithm there:
Differentiate each term, using the chain rule for \(\ln(1-x)\):
An interior critical point must satisfy \(2-5x=0\), so \(x=2/5\). On \(0<x<1\), the denominator \(x(1-x)\) is positive. Therefore \(G'(x)>0\) when \(x<2/5\) and \(G'(x)<0\) when \(x>2/5\). Since \(F'=FG'\) and \(F>0\), \(F\) increases up to \(2/5\) and decreases afterward.
The endpoint values are \(F(0)=0\) and \(F(1)=0\), so the interior point gives the global maximum. Its value is
As a check, the logarithmic derivative at \(2/5\) is \(2/(2/5)-3/(3/5)=5-5=0\). Thus \(F'=FG'=0\) there, and the derivative sign changes from positive to negative, confirming the maximum.
Variable Exponents
Logarithms are especially useful when the variable appears as an exponent. If \(x>0\), then
The right-hand side is usually easier to differentiate than \(x^x\) directly. More generally, for \(a(x)>0\), the expression \(a(x)^{q(x)}\) can be written as \(\exp(q(x)\ln a(x))\). Differentiating its logarithm avoids treating the changing base and changing exponent as separate complications.
Worked Example: Maximizing \(x^{1/x}\)
Consider \(F(x)=x^{1/x}\) for \(x>0\). This objective is positive throughout its domain. Its logarithm is
Differentiate using the quotient rule:
Because \(x^2>0\), the critical-point equation is \(1-\ln x=0\), giving \(x=e\). For \(0<x<e\), \(\ln x<1\), so \(G'(x)>0\). For \(x>e\), \(\ln x>1\), so \(G'(x)<0\). The original objective has the same derivative sign because \(F'=FG'\).
At the critical point,
This is a global maximum on \(x>0\). Indeed, the derivative sign shows that \(F\) increases up to \(e\) and decreases afterward. The limiting values at the ends of the domain are consistent with this conclusion: as \(x\) approaches \(0\) from above, \(\ln F(x)=\ln x/x\) tends to \(-\infty\), so \(F(x)\) tends to \(0\); as \(x\) tends to infinity, \(\ln F(x)\) tends to \(0\), so \(F(x)\) tends to \(1\), which is less than \(e^{1/e}\).
Finally, the critical-point check is \(G'(e)=(1-\ln e)/e^2=0\), and therefore \(F'(e)=F(e)G'(e)=0\).
Worked Example: A Product with Variable Exponents
Worked Example: Maximizing \(x^{-x}(1-x)^{-(1-x)}\)
Let \(F(x)=x^{-x}(1-x)^{-(1-x)}\) for \(0<x<1\). Both bases are positive, so \(F\) is positive and logarithms are valid. Set \(G(x)=\ln F(x)\):
Differentiate the first term using the product rule. For the second, differentiate \((1-x)\ln(1-x)\) before applying the negative sign:
Adding these expressions gives
The critical-point equation is \(\ln((1-x)/x)=0\). Since \(\ln y=0\) exactly when \(y=1\), this gives \(1-x=x\), hence \(x=1/2\).
When \(x<1/2\), \((1-x)/x>1\), so \(G'(x)>0\). When \(x>1/2\), \((1-x)/x<1\), so \(G'(x)<0\). Thus \(F\) increases and then decreases, and the critical point is a global maximum. Its value is
At this point, \(G'(1/2)=\ln 1=0\), so \(F'(1/2)=F(1/2)G'(1/2)=0\). As a further boundary check, \(x\ln x\) tends to \(0\) as \(x\) approaches \(0\) from above; the corresponding endpoint limits of \(F\) are both \(1\), below the maximum value \(2\).
A Common Mistake: Taking Logs Without Checking Positivity
A logarithm can only be taken of a positive quantity. For example, the objective \(H(x)=-x^2\) is never positive. The expression \(\ln(-x^2)\) is therefore undefined for every real \(x\); differentiating it cannot be a valid optimization method. In fact, \(H\) has maximum \(0\) at \(x=0\), which must be found by analyzing \(H\) itself.
Another error is to mishandle a variable exponent. The correct identity is \(\ln(x^x)=x\ln x\) for \(x>0\), not \((\ln x)^x\). For instance, at \(x=2\), \(\ln(2^2)=\ln 4=2\ln 2\), whereas \((\ln 2)^2\) is a different quantity.
Using the Method Reliably
Logarithmic simplification finds candidate points; it does not by itself establish that a candidate is a global maximum. A reliable analysis still identifies the domain, checks any boundary points where the objective is defined, solves the logarithmic critical-point equation, and compares candidates or establishes the sign of the derivative.
When the objective is a product of positive factors, the logarithm often makes the derivative manageable. If \(F(x)=\prod_{i=1}^{n} a_i(x)^{r_i}\), where every \(a_i(x)>0\) and the exponents \(r_i\) are constant, then
The second formula follows by differentiating the first and using \(G'=F'/F\). It gives an equivalent critical-point equation: set the sum on the right equal to zero, provided the point lies in the domain. For variable exponents, first write each logarithmic term explicitly, such as \(q(x)\ln a(x)\), and then differentiate it with the product rule.
The essential benefit is that multiplication and exponentiation become addition and multiplication inside the logarithm. The essential limitation is that this transformation depends on positivity. Keeping both facts in view lets logarithms simplify an optimization problem without changing what is being optimized.
Check Your Understanding
Use the conditions and derivative relationship developed above to answer these questions.
- Why do \(F\) and \(\ln F\) have the same global maximizers when \(F\) is positive?
- For a positive differentiable objective \(F\), what identity relates \((\ln F)'\) to \(F'\), and why does it preserve interior critical points?
- Write \(\ln\bigl(a(x)^3b(x)^2\bigr)\) as a sum, assuming both factors are positive.
- For \(F(x)=x^x\) with \(x>0\), what is \(\ln F(x)\)?
- Why is taking the logarithm not a valid method for maximizing \(H(x)=-x^2\) over the real numbers?