Why a Trigonometric Variable Power Needs Care
A function such as \(y=(\sin x)^{\cos x}\) has two changing parts: its base \(\sin x\) varies with \(x\), and its exponent \(\cos x\) varies as well. Differentiating only the base or only the exponent misses part of the change.
There is also a domain condition. For a general real exponent, a real-valued power \(g(x)^{h(x)}\) is defined through the natural logarithm only when \(g(x)>0\). Therefore, the real-valued function \((\sin x)^{\cos x}\) is considered on intervals where \(\sin x>0\), namely \((2k\pi,(2k+1)\pi)\) for integers \(k\).
The central method is to express a positive-base power using the exponential function, take its natural logarithm, and differentiate. This makes the contributions from the changing base and changing exponent visible in a single formula.
The Derivative Rule for a Variable Power
The formula contains two terms inside the parentheses. The term \(h'(x)\ln(g(x))\) accounts for the changing exponent. The term \(h(x)g'(x)/g(x)\) accounts for the changing base. Neither term can generally be omitted.
Why the Rule Works
Because \(g(x)>0\), the power can be rewritten using the identity \(a^b=\exp(b\ln a)\) for \(a>0\). Thus
Take the natural logarithm of both sides. Then differentiate both sides, using the chain rule and the product rule on \(h(x)\ln(g(x))\):
Here, the derivative of \(\ln y\) is \(y'/y\), since \(y>0\). Multiplying by \(y\), and then substituting \(y=g(x)^{h(x)}\), gives the stated rule. This derivation also explains the two terms: differentiating the product \(h(x)\ln(g(x))\) produces one term from each factor.
Applying the Rule to Sine Raised to Cosine
For \(y=(\sin x)^{\cos x}\), take \(g(x)=\sin x\) and \(h(x)=\cos x\). On any interval where \(\sin x>0\), we have \(g'(x)=\cos x\) and \(h'(x)=-\sin x\). The general rule gives
Every logarithm in this expression has a positive argument because the formula is being used only where \(\sin x>0\). The factor \(-\sin x\ln(\sin x)\) comes from differentiating the exponent \(\cos x\); the fraction comes from differentiating the base \(\sin x\).
Worked Example: Differentiate \((\sin x)^{\cos x}\) at \(x=\pi/6\)
First, \(\sin(\pi/6)=1/2>0\), so this point lies in the domain interval \((0,\pi)\). The function value is
Use the derivative formula. At \(x=\pi/6\), the needed values are \(\sin x=1/2\), \(\cos x=\sqrt3/2\), and \(\ln(\sin x)=\ln(1/2)=-\ln 2\). Therefore, the bracket in the derivative is
Hence
Check by differentiating the logarithmic form: \(\ln y=\cos x\ln(\sin x)\). Its derivative at \(\pi/6\) is \(\frac12\ln 2+\frac32\), exactly the bracket above. Since \(y'/y\) equals this derivative, multiplying by \(y(\pi/6)=(1/2)^{\sqrt3/2}\) gives the same result.
A Different Trigonometric Base
The method is not specific to sine as the base. For \(y=(\cos x)^{\sin x}\), the base must satisfy \(\cos x>0\). This holds on intervals \((-\pi/2+2k\pi,\pi/2+2k\pi)\), where \(k\) is an integer. Taking \(g(x)=\cos x\) and \(h(x)=\sin x\) gives \(g'(x)=-\sin x\) and \(h'(x)=\cos x\), so
The minus sign in the second term comes from the derivative of the cosine base. Keeping track of that sign is part of applying the rule correctly.
Worked Example: Differentiate \((\cos x)^{\sin x}\) at \(x=\pi/3\)
Since \(\cos(\pi/3)=1/2>0\), the function is defined there. Its value is
At this point, \(\cos x=1/2\), \(\sin x=\sqrt3/2\), \(\ln(\cos x)=-\ln 2\), and \(\tan x=\sqrt3\). Substitute these values into the bracket:
Thus
For a check, \(\ln y=\sin x\ln(\cos x)\). Differentiating gives \(\cos x\ln(\cos x)-\sin x\tan x\), whose value at \(\pi/3\) is \(-\frac12\ln 2-\frac32\), as calculated. Multiplying by the function value recovers the derivative above.
When the Trigonometric Argument Is Not Just \(x\)
If a sine or cosine has an inner function, the chain rule applies to both the base and the exponent. For \(y=(\sin(2x))^{\cos(2x)}\), the base is positive wherever \(\sin(2x)>0\). In the general formula, \(g'(x)=2\cos(2x)\) and \(h'(x)=-2\sin(2x)\). Therefore, on any interval where \(\sin(2x)>0\),
The factors of \(2\) arise from differentiating the inner argument \(2x\). Omitting them would ignore the chain rule.
Worked Example: Differentiate \((\sin(2x))^{\cos(2x)}\) at \(x=\pi/12\)
Here \(2x=\pi/6\), so \(\sin(2x)=1/2>0\), and the function value is
The bracket in the derivative formula becomes
Consequently,
Check using \(\ln y=\cos(2x)\ln(\sin(2x))\). Differentiation gives the same bracket, and at \(x=\pi/12\) its value is \(\ln 2+3\). Multiplying by the original function value confirms the derivative.
A Useful Special Check
At \(x=\pi/2\), \(\sin x=1>0\), so \((\sin x)^{\cos x}\) is defined on a neighborhood of that point. The general derivative formula yields a quick consistency check: \(\ln(\sin(\pi/2))=\ln 1=0\), and \(\cos(\pi/2)=0\). Both terms in the bracket vanish, so the derivative is \(0\). This is consistent with the logarithmic form \(\ln y=\cos x\ln(\sin x)\), whose derivative also vanishes there.
Common Mistake: Differentiating Only the Base
A tempting but incorrect calculation is to treat \((\sin x)^{\cos x}\) as though the exponent were constant. That would give only the base-change term:
This leaves out the derivative of the exponent. For example, at \(x=\pi/6\), this incorrect expression gives \((1/2)^{\sqrt3/2}(3/2)\). The correct derivative is \((1/2)^{\sqrt3/2}(3/2+\frac12\ln 2)\), so the omitted term is nonzero.
Domain and Sign Checks
Before applying the formula, check that the base is positive on the interval under consideration. For \((\sin x)^{\cos x}\), this means restricting to intervals where \(\sin x>0\); for \((\cos x)^{\sin x}\), it means \(\cos x>0\). A formula containing \(\ln(\sin x)\) or \(\ln(\cos x)\) cannot be used where its logarithm has a nonpositive argument.
Also differentiate the exponent carefully. The derivative of \(\cos x\) is \(-\sin x\), while the derivative of \(\sin x\) is \(\cos x\). If the argument is \(u(x)\), then the chain rule supplies the additional factor \(u'(x)\). Keeping the base derivative, exponent derivative, and domain condition visible makes the calculation reliable.
Check Your Understanding
For each problem, first state the condition on the base, then apply the variable-power rule.
- On what intervals is \((\sin x)^{\cos x}\) real-valued by the positive-base definition?
- Write the derivative of \((\sin x)^{\cos x}\) at an \(x\) where \(\sin x>0\).
- For \(y=(\cos x)^{\sin x}\), which term in the derivative contains the derivative of the exponent?
- Differentiate \((\sin(3x))^{\cos(3x)}\) on an interval where its base is positive.
- Explain why the derivative formula for a positive-base variable power cannot be applied at a point where the base is zero.