# Logarithmic differentiation of y = f(x)

Differentiates y = f(x) by taking ln of both sides: ln y, y′/y and dy/dx, checked numerically.

- Page: https://www.acalculator.org/math/logarithmic-differentiation-calculator
- JSON spec: https://www.acalculator.org/math/logarithmic-differentiation-calculator.json
- Version: 8d112d72cb56

## Default answer

Example with the default inputs (y = f(x) x^x): By logarithmic differentiation, the derivative of y = x^x is x^x (1 + ln(x)).

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| f | y = f(x) | A product, quotient or power of functions of x, typed like x^x or (x^2 + 1)^3 (x - 2)^4. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| derivative | dy/dx | The derivative, written as y times the derivative of ln y. |
| lny | ln y = | ln of both sides, with the logarithm laws applied. |
| dlog | y′/y = | The derivative of ln y. |

## Method

ln y = ln f(x), expanded by the logarithm laws, then y′/y = d/dx ln y and dy/dx = y · (y′/y). A computer algebra system differentiates; the answer is checked against a difference quotient.

## Assumptions

- The variable is x; angles are in radians; ln is the natural logarithm.
- An answer that fails its check is not shown.

## Worked examples

1. f = (2x^4 + 1)^(tan(x)) gives dlog = 8x^3 tan(x)/(1 + 2x^4) + ln(1 + 2x^4) sec(x)^2. Source: OpenStax, Calculus Volume 1, section 3.9 Derivatives of Exponential and Logarithmic Functions, Example 3.81. https://openstax.org/books/calculus-volume-1/pages/3-9-derivatives-of-exponential-and-logarithmic-functions.
2. f = x sqrt(2x + 1)/(e^x sin(x)^3) gives dlog = 1/(1 + 2x) - 1 - 3 cos(x)/sin(x) + 1/x.

## FAQ

### What is logarithmic differentiation?

A way to differentiate y = f(x) by first taking the natural logarithm of both sides. The logarithm laws turn products into sums, quotients into differences and powers into multiples, so ln y is easy to differentiate. Then y′/y = (ln y)′, and dy/dx = y · (ln y)′.

### When should I use it?

When the variable is in both the base and the exponent, such as x^x or x^sin(x), where neither the power rule nor the exponential rule applies. It also saves work for long products and quotients, such as x √(2x + 1)/(eˣ sin³x).

### What is the derivative of x^x?

ln y = x ln x. Differentiating, y′/y = ln x + 1 by the product rule. So dy/dx = x^x (1 + ln x).

### Why do the logarithms have absolute values?

y can be negative, and ln is only defined for positive numbers. Taking ln|y| instead works on both sides, and the derivative of ln|u| is u′/u, the same as that of ln u. The page writes ln y with bars; the derivative is the same either way.

### Is the answer the same as the ordinary derivative?

Yes, wherever y is not 0: y · (y′/y) = y′. It is written in the log-differentiation form y times a sum, which is how textbooks leave it; multiplying out gives the form of the product and quotient rules.

### How is the answer checked?

The computer algebra system differentiates ln y, and its derivative is compared with a numeric difference quotient at 20 points. The page also checks that the expanded ln y equals ln|y| at 18 test points. If a check fails, it says "No verified answer".

## Sources

- OpenStax, Calculus Volume 1, section 3.9 Derivatives of Exponential and Logarithmic Functions: https://openstax.org/books/calculus-volume-1/pages/3-9-derivatives-of-exponential-and-logarithmic-functions
