If $f: \Bbb R \rightarrow \Bbb R$ is continuous at $a$ then $f^2$ is continuous at $a$ If $f: \Bbb R \rightarrow \Bbb R$ is continuous at $a$ then $f^2$ is continuous at $a$. (use the definition of continuity)
My idea: I know that if f is continuous at a then:
$$ \forall \epsilon > 0, \exists \delta>0 :  |x-a|< \delta \Longrightarrow |f(x)-f(a)|< \epsilon $$
I want to have for a $\delta_1$ then it satisfies that  $|f^2(x)-f^2(a)|< \epsilon$, my try:
I know that
$$ -\epsilon  <f(x)-f(a)< \epsilon $$
$$ -\epsilon \cdot (f(x)+f(a))  <(f(x)-f(a)) \cdot (f(x)+f(a))< \epsilon \cdot (f(x)+f(a)) $$
$$ -\epsilon \cdot (f(x)+f(a))  <f^2(x)-f^2(a)< \epsilon \cdot (f(x)+f(a)) $$
From here I can't advance anymore, I don't know if my approach was right.
Can you help me with this?
Note: $f^2= f \cdot f$
 A: If you really want to use a $\varepsilon-\delta$ approach, you can start by taking $\delta_0>0$ such that$$|x-a|<\delta_1\implies|f(x)-f(a)|<1,$$and then$$|x-a|<\delta_1\implies|f(x)|\leqslant|f(x)-f(a)|+|f(a)|<1+|f(a)|,$$and therefore$$|x-a|<\delta_1\implies|f(x)+f(a)|\leqslant1+2|f(a)|.$$Now, given $\varepsilon>0$, take $\delta_2>0$ such that$$|x-a|<\delta_2\implies|f(x)-f(a)|<\frac\varepsilon{1+2|f(a)|},$$and then$$|x-a|<\min\{\delta_1,\delta_2\}\implies\left|f^2(x)-f^2(a)\right|=\left|f(x)+f(a)\right|\left|f(x)-f(a)\right|<\varepsilon.$$Of course, it's much to solve the problem using that fact that if two functions are continuous at a point, then so is their product. Or the fact that if a function $f$ is continuous at a point $a$ and if a function $g$ is continuous at $f(a)$, then $g\circ f$ is continuous at $a$.
A: Talk it through. The idea that $\lim_{x\to x_0} f(x)=L,$ is, in words,

“If you challenge me with some epsilon, to prove that this function’s output around $x_0$ is between the limit $L$ plus or minus epsilon, then I can respond by giving you some delta, such that if I am within delta of $x_0$, I can prove that I will be within epsilon of $L$.”

So there is a challenge range of outputs sent to a prover, who responds with a range of inputs and a proof. That is what this $\delta,\epsilon$ definition really means in words.*
Now here you have a composition of a squaring and a function, you are told that this statement is true for $f$, so $f$ limits to $L$ at some $x_0$, you want to prove that the composition limits to $L^2$ at the same input $x_0$. So you are going to be one prover, but you are asked to “pass the buck” to some other prover who is sort of a black box. What is the path forward? “You want me to be within $\epsilon$ of $L^2$? Sure, I can do that, I just need $f(x)$ to be a lot closer than $\epsilon$ to $L.$”
Do you see the danger? There are going to be two different epsilons, the one that you are given as a challenge, and the one that you give to the black box who will give you $\delta$ and complete the proof. We better keep those two different epsilons separate!
So to make sure that $f^2$ is between $L^2\pm\epsilon$ we are going to take a square root and say that $f$ is between $L\pm\epsilon'$ for some different $\epsilon'.$ and if we just take the positive case and square it we can see $L^2 + 2L \epsilon'+\epsilon'^2.$
We can take this in two cases, or we can be clever... I prefer to take it in two cases for exposition. First case is easy, if $L=0$ we hand $\epsilon'=\sqrt{\epsilon}$ to the black box. In proof terms “we know that for all $\epsilon'$, there exists $\delta$... so for the specific case $\epsilon'=\sqrt{\epsilon}$ there exists a specific $\delta'$...” which eventually completes the proof, we hand that $\delta'$ plus the proof from the black box that its output is within $\epsilon'$ plus our proof that if $f$ is within $\sqrt{\epsilon}$ of zero then $f^2$ is within $\epsilon$ of zero.
Other case, if $\epsilon,\epsilon'$ are small then we can kind of ignore $\epsilon'^2$ relative to $2L\epsilon'$ and handle this by challenging our black box to get within something like $\epsilon'=\epsilon/(2L)$. But, that is technically too big with the $\epsilon'^2$ so we choose something a healthy amount smaller, say $\epsilon'=\epsilon/(4L)$ “just to be sure.” Also if that is bigger than some number (I think $8 L^2$?) we just choose to “max out” at that number.**
So then when we expand the square we get $(L+\epsilon')^2 = L^2 + \epsilon/2 + (\epsilon/(4L))^2$, and we can prove that this is less than or equal to $L^2+ \epsilon,$ fulfilling our part of the challenge. We can then again pass the buck onto our black box, “we know that for all $\epsilon'$, there exists $\delta$... so for the specific case $\epsilon'=\operatorname{min}(\epsilon/(4L), 8L^2)$ there exists a specific $\delta'$...” and we hand back that $\delta'$ plus the proof.
*(Technically thie way I have worded this challenge-response approach assumes that the existence proof constructs a suitable $\delta$ which is not necessarily the case, maybe some proof is actually based on the axiom of choice or so and does not construct a value but merely proves that one must exist... but I am trying to give a pedagogical feel for how we should attack the problems and this point of rigor does not affect the strategy that we use to attack, you still get to say “well they won't tell me what it is but they sure proved that it exists, and if it exists then it also works for me.”)
**(The other answer was much cleverer and said $\epsilon/(1+2|L|)$ which does not have the division by zero case and also is that “healthy amount smaller,” but I think it also needs to “max out” in a similar way.)
