Extrapolating $\pi$ using Taylor expansion Let $P_n$ be a polygon inscribed in a circle with diameter $1$. Each side of the polygon has length $l_n=\sin(\pi /n)$ and the circumference of $P_n=nl_n$.
With
$$P_n= \pi - \frac{\pi^3}{3!}\frac{1}{n^2}+ \frac{\pi^5}{5!}\frac{1}{n^4}- \frac{\pi^7}{7!}\frac{1}{n^6}+\dots$$
We have $P_2=2,~P_3=\frac{3\sqrt{3}}{2},~P_4=2\sqrt{2},P_6=3$.
Extrapolate using the values $P_2$,...,$P_4$ and give estimates and the error for $\pi$.
$$P_2= \pi - \frac{\pi^3}{3!}\frac{1}{2^2}+ \frac{\pi^5}{5!}\frac{1}{2^4}- \frac{\pi^7}{7!}\frac{1}{2^6}+O(h^8)$$
$$P_3= \pi - \frac{\pi^3}{3!}\frac{1}{3^2}+ \frac{\pi^5}{5!}\frac{1}{3^4}- \frac{\pi^7}{7!}\frac{1}{3^6}+O(h^8)$$
$$P_4= \pi - \frac{\pi^3}{3!}\frac{1}{4^2}+ \frac{\pi^5}{5!}\frac{1}{4^4}- \frac{\pi^7}{7!}\frac{1}{4^6}+O(h^8)$$
$$P_6= \pi - \frac{\pi^3}{3!}\frac{1}{6^2}+ \frac{\pi^5}{5!}\frac{1}{6^4}- \frac{\pi^7}{7!}\frac{1}{6^6}+O(h^8)$$
To remove the first error term I extrapolarted $\frac{4P_4-P_2}{3}$ and $\frac{4P_6-P_3}{3}$, and got approximations with errors $1.17838\%$ and $0.00762\%$ respectively. How do I extrapolate $P_2$ with $P_3$ and further to eliminate the 2nd and 3rd order terms?
 A: Denote by $a,b,c,d$ the coefficents for $P_2,P_3,P_4,P_6$.
The errors cancel if
$$\left(
\begin{array}{ccc}
 \frac{1}{2^2} & \frac{1}{2^4} & \frac{1}{2^6} \\
 \frac{1}{3^2} & \frac{1}{3^4} & \frac{1}{3^6} \\
 \frac{1}{4^2} & \frac{1}{4^4} & \frac{1}{4^6} \\
 \frac{1}{6^2} & \frac{1}{6^4} & \frac{1}{6^6} \\
\end{array}
\right)^T.\left(
\begin{array}{c}
 a \\
 b \\
 c \\
 d \\
\end{array}
\right)=\left(
\begin{array}{c}
 0 \\
 0 \\
 0 \\
\end{array}
\right)$$
Letting $a=1$ the equation becomes
$$\left(
\begin{array}{ccc}
 \frac{1}{3^2} & \frac{1}{3^4} & \frac{1}{3^6} \\
 \frac{1}{4^2} & \frac{1}{4^4} & \frac{1}{4^6} \\
 \frac{1}{6^2} & \frac{1}{6^4} & \frac{1}{6^6} \\
\end{array}
\right)^T.\left(
\begin{array}{c}
 b \\
 c \\
 d \\
\end{array}
\right)=\left(
\begin{array}{c}
 -\frac{1}{2^2} \\
 -\frac{1}{2^4} \\
 -\frac{1}{2^6} \\
\end{array}
\right)\quad\Rightarrow\quad\left(
\begin{array}{c}
 b \\
 c \\
 d \\
\end{array}
\right)=\left(
\begin{array}{c}
 -\frac{162}{7} \\
 \frac{512}{7} \\
 -81 \\
\end{array}
\right)$$
The linear combination of $P$s gives $\pi$ times $a+b+c+d$, so
$\pi\approx\frac{aP_2+bP_3+cP_4+dP_6}{a+b+c+d}=3.14158884937$
