Integral to measure error within 10^-8 If someone could give me background on HOW to solve this problem, NOT THE ANSWER, that would be appreciated. I would love to know how to approach this problem in the most efficient and universal way. Thank you :-) 
 A: As said in comments, start with the Taylor series of $$\cos(y)=\sum_{n=0}^{\infty}\frac{(-1)^n y^{2n}}{(2n)!}$$ Now, replace $y$ by $x^2$ to get $$\cos(x^2)=\sum_{n=0}^{\infty}\frac{(-1)^n x^{4n}}{(2n)!}$$ and integrate to get $$\int \cos(x^2)~dx=\sum_{n=0}^{\infty}\frac{(-1)^n x^{4n+1}}{(4n+1)(2n)!}$$ So, the error bound of $10^{-8}$ will correspond to a value of $n$ such that $$\frac{(0.1)^{4n+1}}{(4n+1)(2n)!} \lt 10^{-8}$$ For $n=1$, the lhs is $10^{-6}$ but for $n=2$, the lhs is $4.62963 \times 10^{-12}$. So two terms are sufficient.
Let us check and write $$I_m=\int_{0.0}^{0.1} \cos(x^2)~dx=\sum_{n=0}^{n=m}\frac{(-1)^n (0.1)^{4n+1}}{(4n+1)(2n)!}$$ We then find $$I_1=0.0999990000000000000$$ $$I_2=0.0999990000046296296$$ $$I_3=0.0999990000046296189$$ $$I_4=0.0999990000046296189$$ while the exact value is $0.099999000004629618946$
A: First note that the series expansion for a function inside the interval $\left[ {{x_{\rm{i}}},{x_{\rm{f}}}} \right]$, which has nice properties (continuity, n-fold differentiability) is
$$f(x) = \sum\limits_{n = 0}^N {\frac{{{f^{(n)}}({x_{\rm{i}}})}}{{n!}}{{\left( {x - {x_{\rm{i}}}} \right)}^n}}  + \frac{{{f^{(n+1)}}(\xi )}}{{(n + 1)!}}{\left( {x - {x_{\rm{i}}}} \right)^{n + 1}}$$where $\xi  \in \left[ {{x_{\rm{i}}},{x_{\rm{f}}}} \right]$. Notice that the error which you have put limit on is the second term in the R.H.S. specifically $${e_n} = \frac{{\left| {{f^{(n+1)}}(\xi )} \right|}}{{(n + 2)!}}{0.1^{n + 2}} < {10^{ - 8}}$$It is easy to see that if $k \in \left\{ {0,1,2,...} \right\}$, then $$\mathop {\max }\limits_{0 \le \xi  \le 0.1} \left| {{{\left. {\left( {\frac{{{d^{n+1}}}}{{d{x^{n+1}}}}\cos {x^2}} \right)} \right|}_{x = \xi }}} \right| = \left\{ \begin{array}{l}\left| {{{\left. {\left( {\frac{{{d^{n+1}}}}{{d{x^{n+1}}}}\cos {x^2}} \right)} \right|}_{x = 0}}} \right|{\rm{   ,}}n+1 = 4k\\\left| {{{\left. {\left( {\frac{{{d^{n+1}}}}{{d{x^{n+1}}}}\cos {x^2}} \right)} \right|}_{x = 0.1}}} \right|{\rm{ ,}}n+1 \ne 4k\end{array} \right.$$so that the maximum error for the integral is $${e_1} \approx {10^{ - 5}},{e_2} \approx 5 \times {10^{ - 6}},{e_3} \approx {10^{ - 6}},{e_4} \approx 4 \times {10^{ - 10}}$$according to the above calculations, we should use 4 terms of the series expansion, so that $$\int\limits_0^{0.1} {\cos {x^2}dx}  \approx \int\limits_0^{0.1} {\left( {1 - \frac{{{x^4}}}{2}} \right)dx}  = \frac{{99999}}{{1000000}}$$ Note that the above error analysis is a worst case analysis and the actual error in the calculated integral is less than $5 \times {10^{ - 12}}$.
