Source and context of $\frac{22}{7} - \pi = \int_0^1 (x-x^2)^4 dx/(1+x^2)$? Possibly the most striking proof of Archimedes's inequality $\pi < 22/7$ is an integral formula for the difference:
$$
\frac{22}{7} - \pi = \int_0^1 (x-x^2)^4 \frac{dx}{1+x^2},
$$
where the integrand is manifestly positive.  This formula is "well-known" but its origin remains somewhat mysterious.  I ask:

Who discovered this integral, and in what context?

The earliest reference I know of is Problem A-1 on the 29th Putnam Exam (1968).  According to J.H.McKay's report in the American Math. Monthly (Vol.76 (1969) #8, 909-915), the Questions Committee consisted of N.D.Kazarinoff, Leo Moser, and Albert Wilansky.  Is one of them the discoverer, and if so which one?
The printed solution, both in the Monthly article and in the book by Klosinski, Alexanderson, and Larson, says only "The standard approach, from elementary calculus, applies. By division, rewrite the integrand as a polynomial plus a rational function with numerator of degree less than 2. The solution follows easily."  But surely there's more to be said, because this integral is a minor miracle of mathematics:
$\bullet$ Not only is the integrand manifestly positive, but it is always small: $x-x^2 \in [0,1/4]$ for $x \in [0,1]$, and the denominator $1+x^2$ is at least 1, so $(x-x^2)^4/(x^2+1) < 1/4^4 = 1/256$.  A better upper bound on the integral is $\int_0^1 (x-x^2)^4 dx$, which comes to $1/630$ either by direct expansion or by recognizing the Beta integral $B(5,5)=4!^2/9!$.  Hence $\frac{22}{7} - \pi < 1/630$, which also yields Archimedes's lower bound $\pi > 3\frac{10}{71}$.
$\bullet$ The "standard approach" explains how to evaluate the integral, but not why the answer is so simple.  When we expand
$$
\frac{(x-x^2)^4}{1+x^2} = x^6 - 4x^5 + 5x^4 - 4x^2 + 4 - \frac4{x^2+1},
$$
the coefficient of $x/(x^2+1)$ vanishes, so there's no $\log 2$ term in the integral.  [This much I can understand: the numerator $(x-x^2)^4$ takes the same value $(1\pm i)^4 = -4$ at both roots of the denominator $x^2+1$.]  When we integrate the polynomial part, we might
expect to combine fractions with denominators of 2, 3, 4, 5, 6, and 7, obtaining a complicated rational number.  But only 7 appears: there's no $x$ or $x^3$ term; the $x^4$ coefficient 5 kills the denominator of 5; and the terms $-4x^5-4x^2$ might have contributed denominators of 6 and 3 combine to yield the integer $-2$.
Compare this with the next such integrals
$$
\int_0^1 (x-x^2)^6 \frac{dx}{1+x^2} = \frac{38429}{13860} - 4 \log 2
$$
and
$$
\int_0^1 (x-x^2)^8 \frac{dx}{1+x^2} = 4\pi - \frac{188684}{15015},
$$
which yield better but much more complicated approximations to $\log 2$ and $\pi$...
This suggests a refinement of the "in what context" part of the question:

Does that integral for $(22/7)-\pi$ generalize to give further approximations to $\pi$ (or $\log 2$ or similar constants) that are useful for the study of Diophantine properties of $\pi$ (or $\log 2$ etc.)?

 A: Beukers mentions (http://www.staff.science.uu.nl/~beuke106/Pi-artikel.ps) that the integrals:
$$\int^{1}_{0} \frac{(x - x^2)^{4n}}{(1 + x^2)} dx$$
give approximations to $\pi$ of the form $p/q$ with $\displaystyle{\left| \pi - \frac{p}{q} \right| < \frac{1}{q^{\theta}}}$ with $\theta \rightarrow \log(4)/\log(2 e^8) = 0.738\ldots$
as $n$ goes to infinity.  So these are not really arithmetically significant.
He also  mentions that the  integrals:
$$J_n = \int^{1}_{0} \frac{(x - x^2)^n}{(1+x^2)^{n+1}} dx$$ 
give approximations  with $\theta \rightarrow 0.9058\ldots$ as $n$ goes to infinity.
However, a further variation by Hata gives the integrals:
$$I_n = \int^{1}_{-1} \frac{x^{2n} (1 - x^2)^{2n}}{(1 + i x)^{3n+1}} dx,$$
with $\theta \rightarrow 1.0449\ldots$, giving an irrationality measure for $\pi$
and providing "explicit" rational approximations. Notes that
 $I_1 = 14 \pi - 44$ gives the approximation $22/7$. (Beukers own integral proofs of the irrationality of $\pi^2$ and $\zeta(3)$ use somewhat different integrals.)
A: Wikipedia quotes the following source:
D.P. Dalzell, On 22/7, J. London Math. Soc. 19 (1944), 133–134, and the MathSciNet review says "By the use of integral calculus the author establishes the inequalities ${\textstyle\frac{22}{7}}-{\textstyle\frac 1{1260}}>\pi>{\textstyle\frac{22}{7}}-{\textstyle\frac 1{630}}$. He then proceeds to develop a series $\pi={\textstyle\frac{22}{7}}+\sum_{n-1}^\infty a_n$, where the $a_n$'s are less in magnitude than the terms of a geometric series of ratio ${\textstyle\frac 1{1024}}$." The latter link is cited by S.K. Lucas, Approximations to $\pi$ derived from integrals with nonnegative integrands, Amer. Math. Monthly 116 (2009), no. 2, 166–172, whose abstract is as follows: "An intriguing definite integral due to Dalzell equals $22/7 - \pi$ where the integrand is nonnegative, and can be used to derive an infinite series for $\pi$. Here we extend Dalzell's results in two ways. First we look at a new family of integrals leading to series for π that converge arbitrarily fast. Then we show how integrals with nonnegative integrands can be found that equal $z - \pi$ or $\pi - z$ for any real $z$." The paper can be downloaded from the author's page here and it contains some further historical account from the 1960s.
A: Jonathan M. Borwein, David H. Bailey and Roland Girgensohn discuss this and related formulae for $\pi$ in their book "Experimentation in Mathematics" (see Section 1.1, p. 3). They claim that

The integral was apparently shown by Kurt Mahler to his students in
  the mid-1960s, and it had appeared in a mathematical examination at the
  University of Sydney in November, 1960.

They mention also a paper by Beuker who further developed the method of integral representations to obtain the irrationality estimate 
$$\left|\pi-\frac{p}{q}\right|\geq\frac{1}{q^{21.04...}},$$
which holds true for all integers $p$, $q$ with sufficiently large $q$. The exponent $21.04...$ is rather far from being optimal. 
A draft of the book is freely available on J.M. Borwein's home page.
A: This integral has a series counterpart
$$\sum_{k=0}^\infty \frac{240}{(4k+5)(4k+6)(4k+7)(4k+9)(4k+10)(4k+11)}=\frac{22}{7}-\pi$$
https://math.stackexchange.com/a/1657416/134791
(UPDATE Peter Bala New series for old functions https://oeis.org/A002117/a002117.pdf, 2009, formula 5.1)
Equivalently,
$$\sum_{k=1}^\infty \frac{240}{(4k+1)(4k+2)(4k+3)(4k+5)(4k+6)(4k+7)}=\frac{22}{7}-\pi$$
which may be seen as the first truncation of
$$\sum_{k=0}^\infty \frac{240}{(4k+1)(4k+2)(4k+3)(4k+5)(4k+6)(4k+7)}=\frac{10}{3}-\pi$$
Therefore, this series shows the following path to $\frac{22}{7}$ 
$$\frac{10}{3}-\frac{240}{1·2·3·5·6·7}=\frac{10}{3}-\frac{2·5!}{\frac{7!}{4}}=\frac{10}{3}-\frac{8·5!}{5!6·7}=\frac{1}{3}\left(10-\frac{4}{7}\right)=\frac{1}{3}·\frac{66}{7}=\frac{22}{7}$$
also illustrating how only $7$ remains.
A: Generalizations are discussed in S. K. Lucas, Integral approximations to $\pi$ with nonnegative integrands, Amer Math Monthly 116 (2009) 166-172. If you don't have access to the Monthly, you can find a preprint on Lucas' website. Lucas agrees with Wikipedia in citing Dalzell. You might also want to see Lucas' earlier paper, Integral proofs that $355/113\gt\pi$, Gazette Aust. Math. Soc. 32 (2005) 263-266.
A: It may be covered by the articles referred to in the earlier answers, but if you integrate
$$\frac{(x-x^2)^{8k+4}}{1+x^2}$$ over the unit interval (for $k$ a non-negative integer), and
rewrite $(x-x^2)^{8k+4}$ as $x^{8k+4}(1+x^{2} -2x)^{4k+2}$, then rewrite
$2^{4k+2}x^{12k+6}$ as $2^{4k+2}(x^{12k+6} +1) -2^{4k+2}$, you can see that 
you get a rational approximation to $2^{4k} \pi$ with an error less than 
$4^{-(8k+4)}$, where the rational approximation is the integral of a polynomial 
with integer coefficients over the unit interval. However the denominator is not usually so straightforward.
