Calculus · real student question

Find the integral of 1/x with respect to x.

Question

Find

1xdx\int\frac{1}{x}\,dx

Step-by-step solution

  1. See why the power rule fails here. The rule xpdx=xp+1p+1\int x^{p}dx=\dfrac{x^{p+1}}{p+1} breaks down at p=1p=-1, because the denominator p+1p+1 becomes zero. So x1dx\int x^{-1}dx is the one exception in the whole family and needs its own answer.

  2. Start from the derivative of the logarithm. For x>0x>0, ddxlnx=1x\dfrac{d}{dx}\ln x=\dfrac{1}{x}, so lnx\ln x is an antiderivative — on the positive axis only, since lnx\ln x is undefined for x0x\le 0.

  3. Handle negative xx, where the integrand is still fine. 1x\dfrac1x is perfectly well defined for x<0x<0, so it must have an antiderivative there too. For x<0x<0 write x=x|x|=-x and differentiate with the chain rule:

    ddxln(x)=1x(1)=1x\frac{d}{dx}\ln(-x)=\frac{1}{-x}\cdot(-1)=\frac{1}{x}

    The same derivative comes out, which is exactly why the absolute value is the right patch.

  4. Combine both cases into one formula.

    1xdx=lnx+C(x0)\int\frac{1}{x}\,dx=\ln\left|x\right|+C\qquad(x\neq 0)

    Writing lnx+C\ln x+C instead would silently restrict the answer to x>0x>0 and give an undefined expression for every negative input.

  5. Note a subtlety about the constant. Because the domain x0x\neq 0 is split into two disconnected pieces, the constant may in fact differ on each side: the fully general antiderivative is lnx+C1\ln|x|+C_{1} for x>0x>0 and lnx+C2\ln|x|+C_{2} for x<0x<0. For definite integrals this matters — an integral crossing 00, such as 11dxx\int_{-1}^{1}\frac{dx}{x}, is improper and divergent, not ln1ln1=0\ln 1-\ln 1=0.

Answer

1xdx=lnx+C\int\frac{1}{x}\,dx=\ln\left|x\right|+C

Need to solve a different problem like this? Open the solver →