Take the following formula:
\begin{equation*} \int_a^b f(x) ~ dx = \frac{h}{2} \left( f(a) + 2\sum_{j=1}^{n-1}f(x_j) + f(b) \right) - \overbrace{\frac{b-a}{12}h^2 f''(\lambda)}^\text{estimation error} \end{equation*}
where $x_0 = a, x_1, \ldots, x_{n-1}, x_n = b$ are evenly spaced points (distance $h$) in the interval $[a, b]$, $f''(\lambda) = \frac{1}{n}\sum_{j=1}^n f''(\zeta_j)$, with $\zeta_j \in (x_{j-1}, x_{j})$.
We wish to determine the minimum value of $n$ such that that the error in the approximation error is $\leq 0.5 \cdot 10^{-6}$ when
$$ f(x) = e^{-x^2}, a = 0, b = 1 $$
I believe I was able to find the right value, but my approach seems very cumbersome. Firstly, I expressed the error as a function of $n$ by noting that, with $a = 0, b = 1$, $h = \frac{1}{2n}$, the second derivative $f$ is
\begin{equation*} f''(x) = 2e^{-x^2}(2x^2 - 1) \end{equation*}
Then, noting that the error can be expressed as
\begin{equation*} E(n) = \frac{1}{12 \cdot 4n^2} f''(\lambda) = \frac{ \sum_{j=1}^n f''(\zeta_j)}{48n^3} \end{equation*}
I found the critical points of $f''$ by equating its derivative to zero:
\begin{aligned} f'''(x) &= 2 \cdot \left( (2x^2-1)\frac{d}{dx} e^{-x^2} + e^{-x^2}(4x) \right) \\ &= 2 \left( (2x^2-1)( -2x )e^{-x^2} + 4x e^{-x^2} \right) \\ &= -4xe^{-x^2}(2x^2-1) + 8x e^{-x^2} \end{aligned}
and
\begin{align*} -4x e^{-x^2}(2x^2-1) + 8x e^{-x^2)} = 0 &\iff x e^{-x^2}(2x^2 -1) - 2xe^{-x^2} = 0 \\ &\iff xe^{-x^2}(2x^2 - 1 - 2) = 0 \\ &\iff ( x = 0 ) \lor ( 2x^2 - 3 = 0 ) \end{align*}
This entails $f''$ has critical points at $x = 0$ and $x = \pm \sqrt{\frac{3}{2}} $. A quick evaluation of $f''$ at these values allows us to see that $\pm \sqrt{\frac{3}{2}} $ are maximums. Then,
\begin{align*} E(n) &= \frac{\sum_{j=1}^n f''(\zeta_j)}{48 n^3} \\ &\leq \frac{ n f'' \left( \sqrt{\frac{3}{2}} \right) }{48n^3} \\ &\leq \frac{0.9}{48n^2} \end{align*}
At last, to make the error less than or equal to $\frac{1}{2} 10^{-6}$, we impose
\begin{aligned} \frac{9}{10\cdot 48n^2} \leq \frac{1}{2}10^{-6} &\iff \frac{18 \cdot 10^6}{10 \cdot 48} \leq n^2 \\ &\iff \sqrt{37500} \leq n \\ &\Leftarrow n = 194 \\ \end{aligned}
The approach given above seems too complicated: first, second, and third derivatives are computed; the third derivative is equated to zero, and to solve it we need to find the roots of a quadratic polynomial; only then can we bound the summation involving $f''(\zeta_j)$. My professor hinted that I was over-complicating the problem, but left as exercise to find a simpler approach. I have failed to do so.
What would be the parsimonious approach to solving this problem?