# Prove that $\pi$ is irrational help

I am working through Cartwright's proof for $\pi$ being irrational; specifically, the problem states:

Given $$A_n=\int_{-1}^{1}(1-x^2)^n\cos\left(\frac {\pi x}{2}\right)\,dx$$

Prove:

$$A_n=\frac {8n(2n-1)A_{n-1}-16n(n-1)A_{n-2}}{\pi ^2}.$$

I must prove it using integration by parts and have gotten really close to the answer but I am stuck at this step:

$$A_n=\frac{-16n(n-1)}{\pi^2}\int_{-1}^{1}x^2(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)+\frac {8n}{\pi^2}A_{n-1}.$$

Specifically, I'm wondering how one could get rid of the $x^2$ term out of the integral to get $A_{n-2}.$

I haven't worked it out, but I wonder if this is the missing step: $$\int_{-1}^{1}(1-x^2)(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)\,dx = \int_{-1}^{1}(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)\,dx -\int_{-1}^{1}x^2(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)\,dx$$ So $$\int_{-1}^{1}x^2(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)\,dx = \int_{-1}^{1}(1-x^2)^{n-2}\cos\left(\frac {\pi x}{2}\right)\,dx -\int_{-1}^{1}(1-x^2)^{n-1}\cos\left(\frac {\pi x}{2}\right)\,dx$$
OK it is simple, you have $$A_n = -\frac{16n(n-1)}{\pi^2}\int_{-1}^1x^2(1-x^2)^{n-2}\cos(\frac{\pi x}{2})dx + \frac{8n}{\pi^2}A_{n-1}$$ $$=-\frac{16n(n-1)}{\pi^2}(-A_{n-1}+A_{n-2}) + \frac{8n}{\pi^2}A_{n-1}$$ $$= \frac{8n}{\pi^2}(2n-1)A_{n-1} - \frac{16n(n-1)}{\pi^2}A_{n-2}$$