Saw this problem on a FaceBook meme that said the pin code to his ATM debit card is the solution to the following problem:

$$\int_{0}^{1} \frac{(3x^3-x^2+2x-4)}{\sqrt{x^2-3x+2}} \, dx$$

I was trying to see how we could break this up into an easier integrals but nothing comes to mind at first glance. Perhaps complex integration is possible?

  • 2
    $\begingroup$ $$x-1$$ a common factor , choose $$\dfrac{x-1}{x-2}=t$$ $\endgroup$ – lab bhattacharjee Dec 13 '19 at 4:22
  • $\begingroup$ @labbhattacharjee How do you express the rest of the numerator ($3x^2+2x+4$) in terms of $t$? $\endgroup$ – Don Thousand Dec 13 '19 at 4:33
  • 1
    $\begingroup$ @DonThousand $$t=\dfrac{x-1}{x-2}=1+\frac{1}{x-2} \\ t-1=\frac{1}{x-2} \\x-2=\frac{1}{t-1} \\ x =\frac{2t-1}{t-1}$$ $\endgroup$ – N. S. Dec 13 '19 at 4:41
  • 1
    $\begingroup$ Seems unlikely to be an ATM code wolframalpha.com/input/… $\endgroup$ – saulspatz Dec 13 '19 at 5:01
  • $\begingroup$ @MartinSleziak Holy crap, thanks for finding a better duplicate $\endgroup$ – Maximilian Janisch Dec 13 '19 at 15:23

As an alternative to the substitution described in the comments, the anti-derivative of expressions of the form $P(x)/\sqrt{ax^2+bx+c}$, $(a\ne 0)$, where $P(x)$ is a non-constant polynomial is: $$\int \frac{P(x)}{\sqrt{ax^2+bx+c}}\mathrm{d}x=Q(x)\sqrt{ax^2+bx+c}+\lambda\int\frac{1}{\sqrt{ax^2+bx+c}}\mathrm{d}x $$ where $Q(x)$ is a polynomial with undetermined coefficients of one degree less than $P(x)$ and $\lambda$ is an unknown number. To find the coefficients, differentiate both sides, get rid of the square root, and equate coefficients for the powers of $x$. In this case: $$\int \frac{3x^3-x^2+2x-4}{\sqrt{x^2-3x+2}}\mathrm{d}x=\left(x^2+\frac{13}{4}x+\frac{101}{8}\right)\sqrt{x^2-3x+2}+\frac{135}{16}\int \frac{1}{\sqrt{x^2-3x+2}}\mathrm{d}x$$ and $$\int \frac{1}{\sqrt{x^2-3x+2}}\mathrm{d}x=\int \frac{1}{\sqrt{\left(x-\frac{3}{2}\right)^2-\frac{1}{4}}}\mathrm{d}x=\ln\left|x-\frac{3}{2}+\sqrt{x^2-3x+2}\right|+C $$

Update: In your case, $P(x)$, the polynomial in the numerator, has degree $3$, so $Q(x)$ has degree $2$: $Q(x)=Ax^2+Bx+C$. So you have $$\int \frac{3x^3-x^2+2x-4}{\sqrt{x^2-3x+2}}\mathrm{d}x=\left(Ax^2+Bx+C\right)\sqrt{x^2-3x+2}+\lambda\int \frac{1}{\sqrt{x^2-3x+2}}\mathrm{d}x$$ and after differentiation: $$\frac{3x^3-x^2+2x-4}{\sqrt{x^2-3x+2}}=(2Ax+B)\sqrt{x^2-3x+2}+(Ax^2+Bx+C)\frac{2x-3}{2\sqrt{x^2-3x+2}}+\frac{\lambda}{\sqrt{x^2-3x+2}} $$ Now, multiply both sides by the square root to remove it, and equate coefficients for the powers of $x$.

  • $\begingroup$ I know about division of polynomials but I've never heard of differentiating in that manner to arrive at the final answer. I differentiated and did not get what you got. $\endgroup$ – adam Dec 13 '19 at 9:49
  • $\begingroup$ @adam see my update $\endgroup$ – bjorn93 Dec 13 '19 at 11:52

Sage solves the integral in no time. The indefinite integral is $$ \sqrt{x^2 - 3x + 2}\left(x^2 + \frac{13}4 x + \frac{101}8\right) + \frac{135}{16}\log\left(3 - 2x - 2\sqrt{x^2 - 3x + 2}\right).$$ And the definite integral is $\frac{135}{16}\log(3 + 2\sqrt 2)-\frac{101}{8}\sqrt 2\approx -2.981267$.

What kind of pin code is that?

  • $\begingroup$ How the hell do you get that ? Lol well at least I know its solvable. $\endgroup$ – adam Dec 13 '19 at 7:37
  • $\begingroup$ Indeed math.stackexchange.com/q/3336353/631742 $\endgroup$ – Maximilian Janisch Dec 13 '19 at 14:18
  • $\begingroup$ As I said in the answer, I solved it with Sage. And I didn't expect this many upvotes, as I really didn't do much work myself, other than simplifying and formatting the output... $\endgroup$ – WhatsUp Dec 13 '19 at 14:24


Substitute $2x-3=-\cosh t$, or $x=\dfrac{3-\cosh t}2$.

We have

$$\int_0^1\frac{3x^3-x^2+2x-4}{\sqrt{x^2-3x+2}}dx=-\int_0^{\text{arcosh }2}(3x^3-x^2+2x-4)\frac{\dfrac{\sinh t}2}{\dfrac{\sinh t}2}dt.$$


$$3x^3-x^2+2x-4=-\frac{-3\cosh^3t+25\cosh^2t-77\cosh t+55}8\\ =-\frac1{32}\cosh 3t+\frac7{16}\cosh 2t-\frac{95}{32}\cosh t+\frac{137}{16}.$$

The rest is routine work.


Not the answer you're looking for? Browse other questions tagged or ask your own question.