Introduction
Exponential and logarithmic expressions appear in many functions of several variables. Their partial derivatives follow familiar one-variable rules, but the variable being differentiated must be identified carefully. In each partial derivative, all other variables are held fixed.
For logarithmic terms, there is an additional issue: their inputs must lie in the logarithm's domain. A formula for a partial derivative is only valid at points where the original function is defined.
Basic Exponential and Logarithmic Rules
The natural exponential function \(e^x\) is defined for every real \(x\), and its derivative is itself. If \(a\) is a positive constant, then \(a^x\) is also defined for every real \(x\). Its derivative includes the factor \(\ln a\).
The second formula also applies when \(a=1\): its right-hand side is \(1^x\ln 1=0\), as expected because \(1^x=1\). The base \(a\) must be positive for the usual real-valued definition of \(a^x\) for arbitrary real \(x\).
The natural logarithm \(\ln x\) is defined only when \(x>0\), and its derivative is \(1/x\). When its input is a differentiable function \(u\), the chain rule gives the corresponding composite formula.
For a logarithm to base \(b\), the base must satisfy \(b>0\) and \(b\ne 1\), and the input must be positive. Since \(\log_b x=\ln x/\ln b\), its derivative is \(1/(x\ln b)\). In what follows, \(\ln\) denotes the natural logarithm.
Why the Exponential and Logarithmic Rules Work
The rule for \(a^u\) follows by rewriting the expression using the natural exponential. For \(a>0\), the identity \(a^u=e^{u\ln a}\) holds. If \(u=u(t)\), differentiating this expression with the chain rule gives the result.
This derivation explains both parts of the formula: the factor \(\ln a\) comes from differentiating the exponent \(u\ln a\), and the factor \(u'(t)\) comes from the chain rule. For \(e^{u(t)}\), the same reasoning yields \(e^{u(t)}u'(t)\), because the coefficient corresponding to \(\ln a\) is \(\ln e=1\).
The logarithm rule can be justified in a similar way. Suppose \(u(t)>0\), and set \(g(t)=\ln u(t)\). Then \(e^{g(t)}=u(t)\). Differentiating both sides and using the chain rule gives \(e^{g(t)}g'(t)=u'(t)\). Since \(e^{g(t)}=u(t)\), division by the positive quantity \(u(t)\) gives \(g'(t)=u'(t)/u(t)\).
Partial Derivatives of Exponentials and Logarithms
For a function \(f(x,y)\), the partial derivative \(f_x\) differentiates with respect to \(x\) while \(y\) is fixed; \(f_y\) differentiates with respect to \(y\) while \(x\) is fixed. Thus, when differentiating \(e^{x}\) with respect to \(x\), the usual exponential rule applies. If the exponent contains both variables, the chain rule also applies to the changing exponent.
For example, in \(a^{x+2y}\), differentiating with respect to \(x\) gives a factor of \(1\) from the exponent, while differentiating with respect to \(y\) gives a factor of \(2\). The base \(a\) remains constant in both derivatives.
Likewise, \(\partial(\ln x)/\partial x=1/x\) where \(x>0\). If differentiating \(\ln x\) with respect to \(y\), then \(x\) is fixed; the expression is constant with respect to that differentiation. The same principle applies to \(\ln y\) when differentiating with respect to \(x\). These facts do not remove the domain restrictions: a function containing \(\ln x\) is still defined only where \(x>0\).
Worked Examples
Worked Example: Separate Exponential and Logarithmic Terms
Find both first partial derivatives of \(f(x,y)=e^x+2^y+\ln x+3\ln y\), and state the domain.
The term \(\ln x\) requires \(x>0\), and \(3\ln y\) requires \(y>0\). The exponential terms are defined for all real \(x\) and \(y\). Therefore the domain is \(x>0,\ y>0\).
For \(f_x\), hold \(y\) fixed. The term \(e^x\) differentiates to \(e^x\), and \(\ln x\) differentiates to \(1/x\). The terms \(2^y\) and \(3\ln y\) are constant with respect to \(x\). Thus
For \(f_y\), hold \(x\) fixed. The derivative of \(2^y\) is \(2^y\ln 2\), and the derivative of \(3\ln y\) is \(3/y\). The other two terms are constant with respect to \(y\). Hence
To check, fix \(y=c>0\). The resulting one-variable function is \(e^x+2^c+\ln x+3\ln c\), whose derivative is \(e^x+1/x\), as found for \(f_x\). Fixing \(x=c>0\) gives \(e^c+2^y+\ln c+3\ln y\), whose derivative is \(2^y\ln 2+3/y\), as found for \(f_y\).
Worked Example: Variable Exponents and Logarithmic Domains
Find \(f_x\) and \(f_y\) for \(f(x,y)=e^{2x-y}+3^{x+2y}+\ln x-2\ln y\). State the domain.
The logarithms require \(x>0\) and \(y>0\), so the domain is the region where both inequalities hold. For the first exponential, the exponent \(2x-y\) has partial derivatives \(2\) with respect to \(x\) and \(-1\) with respect to \(y\). For the second exponential, the exponent \(x+2y\) has partial derivatives \(1\) and \(2\), respectively.
Differentiating with respect to \(x\) gives
The first term includes the factor \(2\) from differentiating \(2x-y\). The logarithmic term \(-2\ln y\) contributes nothing to this derivative because \(y\) is fixed.
Differentiating with respect to \(y\) gives
Here the first exponential has the factor \(-1\) from its exponent, and the second has the factor \(2\). The derivative of \(-2\ln y\) is \(-2/y\).
As a check, fix \(y=c>0\). Differentiating \(e^{2x-c}+3^{x+2c}+\ln x-2\ln c\) with respect to \(x\) gives \(2e^{2x-c}+3^{x+2c}\ln 3+1/x\). Fixing \(x=c>0\) instead gives the one-variable function \(e^{2c-y}+3^{c+2y}+\ln c-2\ln y\), whose derivative is \(-e^{2c-y}+2\cdot 3^{c+2y}\ln 3-2/y\). Both checks agree with the formulas.
Worked Example: Combining the Product Rule with a Logarithm
Find the partial derivatives and domain of \(f(x,y)=xe^y+2^x\ln y+\ln x\).
The term \(\ln y\) requires \(y>0\), and \(\ln x\) requires \(x>0\). Thus the domain is \(x>0,\ y>0\). For \(f_x\), the factor \(e^y\) is constant with respect to \(x\), so the derivative of \(xe^y\) is \(e^y\). The derivative of \(2^x\ln y\) with respect to \(x\) is \(2^x\ln 2\) multiplied by the fixed factor \(\ln y\). Finally, \(\ln x\) contributes \(1/x\).
For \(f_y\), the term \(xe^y\) differentiates to \(xe^y\), since \(x\) is fixed. In \(2^x\ln y\), the factor \(2^x\) is fixed and \(\ln y\) differentiates to \(1/y\). The term \(\ln x\) is fixed. Therefore
For a check of \(f_x\), fix \(y=c>0\). The slice is \(xe^c+2^x\ln c+\ln x\). Its derivative is \(e^c+2^x\ln 2\,\ln c+1/x\). For a check of \(f_y\), fix \(x=c>0\). The slice is \(ce^y+2^c\ln y+\ln c\), whose derivative is \(ce^y+2^c/y\). These are the stated partial derivatives.
A Common Exponential-Derivative Error
A frequent mistake is to treat an exponential such as \(5^x\) as if it were a power of \(x\). The power rule applies to expressions like \(x^5\), not to \(5^x\). For instance, the incorrect calculation
uses the base as though it were the variable and the exponent as though it were fixed. The correct rule is
The distinction is visible by rewriting \(5^x=e^{x\ln 5}\). Differentiating gives \(e^{x\ln 5}\ln 5=5^x\ln 5\). In a partial derivative such as \(\partial(5^y)/\partial x\), \(y\) is fixed; it is not the case that the power rule should be applied to \(5^y\) as a function of \(x\).
Another error is to write \(1/x\) as the derivative of \(\ln x\) without checking that \(x>0\). The formula does not extend the real-valued logarithm to nonpositive inputs. A derivative expression must be interpreted on the domain of the original function.
Why Domain Conditions Matter
Domain restrictions are part of the function, not an optional note attached after differentiation. For example, the formulas for the derivatives of \(\ln x\) and \(\ln y\) require positive inputs, and a function containing both terms is defined only where both restrictions hold. Exponential terms may be defined more broadly, but they do not cancel or remove a logarithm's domain requirement.
Carefully recording the domain also keeps derivative formulas meaningful: denominators such as \(x\) and \(y\) in logarithmic derivatives cannot be zero, and the original logarithms already require those variables to be positive. When a function combines several terms, first collect the restrictions from every logarithmic term, then differentiate on that domain.
Check Your Understanding
Work through these questions, keeping the relevant domains in view.
- Differentiate \(e^{3x}\) with respect to \(x\).
- Find both first partial derivatives of \(2^{x-y}\), assuming \(x\) and \(y\) are real.
- What domain restrictions are required for \(g(x,y)=\ln x+4\ln y\)?
- Differentiate \(\ln(2x+1)\) with respect to \(x\), and state the condition on \(x\).
- Identify the error in the claim that the derivative of \(7^x\) is \(x7^{x-1}\), then give the correct derivative.