Let $$f(x)= \begin{cases} (e^{3x}-3e^x+2)/x^2 & :x \neq 0\\ A & :x=0\\ \end{cases}$$ I'm supposed to find $A$ such that there exists $f'(0)$. My attempt:
First, I found $A$ such that $f$ is continuous at $x=0$, using de l'Hospital's rule to calculate $\lim_{x \to 0^{+}}f(x)$ and $\lim_{x \to 0^{-}}f(x)$. $$f(x)= \begin{cases} (e^{3x}-3e^x+2)/x^2 & :x \neq 0\\ 3 & :x=0\\ \end{cases}$$ Then I calculated one-sided limits of the difference quotient at $x=0$ using de l'Hospital's rule (but I'm not sure if I'm allowed to do so - I've read that applying this rule to the definition of derivative may lead to some kind of circular reasoning). $$\lim_{h \to 0^{+}}\frac{f(0+h)-f(0)}{h}=\lim_{h \to 0^{-}}\frac{f(0+h)-f(0)}{h}=\lim_{h \to 0}\frac{f(0+h)-f(0)}{h}=f'(0)=4$$ Is this solution correct? Wolfram Alpha and Desmos tell me that $f'(0)=0$ for $A=3$. However, when I set $A$ to a different value (meaning the function isn't continuous at $x=0$ and hence not differentiable) I still get $f'(0)=0$, which is quite confusing.

What do you mean by "same result" for$A\ne 3$? In that case $f'(0)$ does not exist.
To get continuity, use power series for the numerator: $1+3x+\frac{9x^2}{2}-3(1+x+\frac{x^2}{2})+2=3x^2$ Therefore $\lim_{x\to 0}3$.