Mathematics RU

Solver

Exponential and logarithmic equation solver with step-by-step working

Type an equation or inequality with powers and logarithms, and the solver finds where it’s defined, picks a method, explains every step and weeds out extraneous roots.

Loading the solver…

What you can type

A power is written with a caret: 2^(x+1), 4^x - 3*2^x + 2 = 0; put an exponent of more than one symbol in brackets. The logarithm to base $a$ is log_a(…): log_2(x - 1), log_(1/3)(x). The logarithm to base ten is lg (English textbooks often write it as plain $\log$), the natural logarithm is ln, and the square of a logarithm is lg^2 x. The number $e$ is written as it is: e^(2x). Instead of an equals sign you can use an inequality: 2^x > 8, log_2(x) <= 3.

The solver works out which case it’s facing and picks a technique: a common base, taking logarithms, substitution, taking out a common factor, changing logarithms to one base. If there’s no exact technique, as with $2^x = x + 1$, the roots are found numerically, and the solver says honestly that the answer is approximate. For this particular equation, though, it notices that the approximate roots look suspiciously like $0$ and $1$, substitutes them exactly and confirms that they are the answer.

Exponential equations: everything comes down to one base

The exponential function $y = a^x$ with $a > 0$, $a \ne 1$ is strictly monotonic: it increases when $a > 1$ and decreases when $0 < a < 1$. So it takes each of its values exactly once, and $a^{f(x)} = a^{g(x)}$ implies $f(x) = g(x)$. Almost everything rests on this.

  1. Bring everything to one base. $3^{2x - 1} = 27$ is $3^{2x - 1} = 3^3$, so $2x - 1 = 3$ and $x = 2$. In the same way $4^x = 8$ becomes $2^{2x} = 2^3$ and $x = \frac{3}{2}$.
  2. If no common base can be found, take logarithms. $2^x = 5$: the number $5$ isn’t a power of two with a rational exponent, and the answer is written as a logarithm, $x = \log_2 5 \approx 2.3219$.
  3. Substitution. If the equation contains $a^{2x}$ and $a^x$, write $t = a^x$ and remember that $t > 0$. The equation becomes quadratic.
  4. A common factor. $2^{x+1} + 2^x = 12$: take out $2^x$ to get $2^x \cdot 3 = 12$, $2^x = 4$, $x = 2$.
  5. Different bases with the same exponent. Divide $3^x = 2^x$ by $2^x$ (it’s never zero): $\left(\frac{3}{2}\right)^x = 1$, so $x = 0$.

There may be no roots at all: $2^x = -4$ has no solutions, since a power of a positive number is always positive.

Logarithmic equations: the domain first

A logarithm is defined only when the number under it is positive and the base is positive and not equal to one. These conditions, the domain of the equation, are written down first, before any rearranging. After that, the techniques mirror the exponential ones.

  1. By definition. $\log_2 x = 3$ means $x = 2^3 = 8$.
  2. Logarithms to the same base. $\lg(x + 1) = \lg(2x - 3)$ implies $x + 1 = 2x - 3$, that is, $x = 4$, followed by a domain check: $x + 1 = 5 > 0$, $2x - 3 = 5 > 0$.
  3. Combine a sum of logarithms into one with $\log_a m + \log_a n = \log_a(mn)$; a difference becomes the logarithm of a quotient, and a factor goes into the exponent.
  4. The substitution $t = \log_a x$, when the logarithm is squared: $\lg^2 x - 3\lg x + 2 = 0$ gives $t^2 - 3t + 2 = 0$, $t = 1$ or $t = 2$, and $x = 10$ or $x = 100$.
  5. Different bases are brought to one: $\log_4 x = \frac{\log_2 x}{\log_2 4} = \frac{1}{2}\log_2 x$.

Why it works

Exponential and logarithmic equations are two views of the same equality. A logarithm answers the question “to what power must the base be raised to get this number?” So any exponential equation of the form $a^{f(x)} = b$ turns in one move into an equation without powers, and a logarithmic one the other way round.

The base: $a > 0$, $a \ne 1$. With $a = 1$ every power equals one, and the question “to what power?” loses its meaning. The exponent: any real number. The number under the logarithm must be positive: $a^x > 0$ for every $x$, so there’s no logarithm of zero or of a negative number. Example: $2^x = 5 \Leftrightarrow x = \log_2 5$. Since $2^2 = 4 < 5 < 8 = 2^3$, the root lies between $2$ and $3$; more precisely, $\log_2 5 = \frac{\ln 5}{\ln 2} \approx 2.3219$, and $2^{2.3219} \approx 5.0000$.

Where extraneous roots come from. The property $\log_a m + \log_a n = \log_a(mn)$ holds only when $m > 0$ and $n > 0$. But the expression $\log_a(mn)$ is also defined when $m$ and $n$ are both negative. Once the logarithms are combined into one, the domain quietly grows, and the answer may include numbers at which the original equation made no sense. So every root found is checked against the domain, and most reliably, substituted into the original equation. The solver does both and marks extraneous roots on the graph with a red circle.

Inequalities add one more rule. If the base is greater than one, the functions $a^x$ and $\log_a x$ increase, and the inequality sign is kept. If the base is between zero and one, they decrease, and the sign is reversed.

When there’s no exact method

Equations like $\ln x = x - 2$ or $2^x = x + 1$ mix a logarithm or a power with a polynomial, and no rearranging brings them to a single base. The roots of such equations usually can’t be expressed by a formula, and that’s not a shortcoming of the solver: it’s how the problem itself is made. This is where a picture helps. The graphs of $y = \ln x$ and $y = x - 2$ cross twice, so there are two roots, and you can roughly see where: near $0.16$ and near $3.15$.

Then the roots are refined numerically: take an interval at whose ends the difference between the two sides has opposite signs, and shrink it until the decimal places stop changing. This is how the solver gets $x_1 \approx 0.1586$ and $x_2 \approx 3.1462$. The check is numerical too: at $x \approx 3.1462$ both sides equal about $1.1462$. Sometimes an approximate root turns out to be “round”: for $2^x = x + 1$ the roots are $0$ and $1$. Then the solver substitutes these numbers exactly and, if the equality holds, writes them in the answer without the “$\approx$” sign.

Worked examples

Example 1. Substitution: $4^x - 3 \cdot 2^x + 2 = 0$

$4^x = (2^2)^x = (2^x)^2$. Write $t = 2^x$, with $t > 0$: we get $t^2 - 3t + 2 = 0$, so $t = 1$ or $t = 2$. Both values are positive. $2^x = 1$ gives $x = 0$, and $2^x = 2$ gives $x = 1$.

Check: $4^0 - 3 \cdot 2^0 + 2 = 1 - 3 + 2 = 0$ and $4 - 6 + 2 = 0$. Answer: $x = 0$, $x = 1$. Had the quadratic had a negative root, it would have to be thrown away: $2^x$ is never negative.

Example 2. An extraneous root: $\log_2(x + 1) + \log_2(x - 1) = 3$

The domain: $x + 1 > 0$ and $x - 1 > 0$, that is, $x > 1$. Combine the logarithms: $\log_2\big((x + 1)(x - 1)\big) = 3$, so $x^2 - 1 = 8$ and $x = \pm 3$.

The root $x = -3$ is outside the domain: it puts negative numbers under both logarithms. That leaves $x = 3$, and the check $\log_2 4 + \log_2 2 = 2 + 1 = 3$ works. Answer: $x = 3$.

Example 3. The unknown in both the base and the exponent: $x^{\lg x} = 100x$

Both sides are positive for $x > 0$, so we can take logarithms to base $10$: $\lg\left(x^{\lg x}\right) = \lg(100x)$, that is, $\lg x \cdot \lg x = 2 + \lg x$. The substitution $t = \lg x$ gives $t^2 - t - 2 = 0$, $t = 2$ or $t = -1$, and $x = 100$ or $x = 0.1$.

Check: $100^{\lg 100} = 100^2 = 10{,}000 = 100 \cdot 100$ and $0.1^{\lg 0.1} = 0.1^{-1} = 10 = 100 \cdot 0.1$. Answer: $x = 0.1$, $x = 100$.

Example 4. An inequality with a base less than one: $\log_{1/2}(x - 1) \ge -2$

The domain: $x > 1$. Write the right-hand side as a logarithm: $-2 = \log_{1/2} 4$. The base $\frac{1}{2} < 1$, so the function decreases, and the sign is reversed: $x - 1 \le 4$, $x \le 5$. Taking the domain into account, the answer is $x \in (1, 5]$. A check with a point from the answer: at $x = 3$ we get $\log_{1/2} 2 = -1 \ge -2$, which is true.

Common mistakes

  • Forgetting that $t > 0$. After the substitution $t = a^x$, negative and zero values of $t$ are thrown away: the equation $2^x = -1$ has no roots.
  • Not writing down the domain, and leaving an extraneous root in the answer, like $x = -3$ in Example 2.
  • Not reversing the inequality sign when the base is less than one.
  • Inventing properties that don’t exist. $\log_a(m + n) \ne \log_a m + \log_a n$; $2^x \cdot 2^x = 4^x$, not $2^{x^2}$; and $\frac{\log_a m}{\log_a n} \ne \log_a \frac{m}{n}$.
  • Cancelling an expression containing the unknown. In $x \cdot 3^x = 3^x$ you can divide by $3^x$ (it’s never zero) and get $x = 1$, but dividing both sides by $x$ in similar places isn’t allowed: that’s how roots get lost.
  • Mixing up $\lg$ and $\ln$. $\lg$ is to base $10$, $\ln$ is to base $e \approx 2.718$.

See also

Where logarithms came from, why $a^0 = 1$, and how a slide rule multiplies by adding lengths are in the chapter on powers and logarithms. The number $e$, the natural logarithm, growth and decay are in the chapter “The number e and the exponential”. A substitution often leaves a quadratic equation, which the quadratic equation solver goes through in detail. Inequalities with polynomials and fractions are solved by the interval method solver, and equations with sines and cosines by the trigonometric equation solver.

Where this is explained

Other solvers