Looking at an expression for $\pi$
$$\pi = \frac{22}7-\int_0^1 \frac{x^4(1-x)^4}{1+x^2} \ dx$$
it seems to me that the integral expression is the error between the approximation $\frac{22}7$ and $\pi$. Is there any history behind the discovery of this integral? Was it tied to the error between the two numbers or was it discovered separately and only later applied?