I'm trying to understand the $\varepsilon$-$\delta$ proof for $$\lim_{x \to 0} x^2\sin\left(\frac{1}{x}\right)=0$$
We have to find $\varepsilon>0$ and $\delta>0$ such that $$ \left|x^2\sin\left(\frac{1}{x}\right)\right| < \varepsilon \tag{1}\label{eq1} $$ and $$ |x|<\delta \tag{2}\label{eq2} $$
My work:
We know $$ \begin{aligned} \left|\sin\left(\frac{1}{x}\right)\right| &\leq 1 \\ \implies \left|x^2\sin\left(\frac{1}{x}\right)\right| &\leq |x^2| \\ \end{aligned} $$ $$ \therefore \text{ } \left|x^2\sin\left(\frac{1}{x}\right)\right| < \delta^2 \tag{3}\label{eq3} $$
For $0<\delta<1$, we have $$ \begin{aligned} \delta^2 &< \delta \\ \implies \left|x^2\sin\left(\frac{1}{x}\right)\right| &< \delta \end{aligned} $$ and hence we can choose any $\delta$, such that $0 < \delta \leq \varepsilon$. So far so good.
But, for $\delta \geq 1$, we have $$ \delta^2 \geq \delta $$ The range of value for $\delta$ in this case that I can think of such that $\eqref{eq1}$ and $\eqref{eq3}$ could be reconciled is $$ \left|x^2\sin\left(\frac{1}{x}\right)\right| < \delta \leq \varepsilon $$
But when I check on a graphing tool, regardless of whether $\delta$ is $<1$ or $\geq 1$, $0<\delta\leq\varepsilon$ holds.
What am I doing wrong?
EDIT:
Since $0<\delta\leq\varepsilon$ and from $\eqref{eq2}$, we get $$ |x|<\delta \leq\varepsilon \implies |x|^2 < \delta^2 \leq \varepsilon^2 $$
So, since $$ \left|x^2\sin\left(\frac{1}{x}\right)\right| \leq |x^2| \\ \implies \left|x^2\sin\left(\frac{1}{x}\right)\right| < \delta ^2 \leq \varepsilon^2 $$
So, can we now say $\delta \leq \varepsilon$, regardless of values that either take?
You're almost there, and there are several ways to finish up. One thing you could do is what @Tito Eliatron suggests in his comment (this might be the most elegant way):
Let $\epsilon > 0$, set $\delta = \sqrt{\epsilon}$. Then, for $|x|<\delta$ we have
\begin{equation} \left|x^2 \sin{\left(\frac{1}{x}\right)}\right| \leq |x|^2 < \delta^2 = \sqrt{\epsilon}^2 = \epsilon. \end{equation}
But there is another way to "fix" your argument. As you have noted, if $\epsilon \leq 1$, you can choose $\delta = \epsilon$ and use the fact that in this case we have $\delta^2 \leq \delta$, and do the same thing as above. Then we deal with the case $\epsilon > 1$ separately. In this case, we can choose $\delta = 1$, and we have for $|x| < \delta:$
\begin{equation} \left|x^2 \sin{\left(\frac{1}{x}\right)}\right| \leq |x|^2 < \delta^2 = 1^2 = 1 < \epsilon. \end{equation}
Thus, we can set $\delta = \min{(\epsilon, 1)}$ and obtain the same result. I think Tito's suggestion is more beautiful since it avoids different cases, but both methods are valid.