I have recently started learning derivatives and I came across this simple looking problem. What is the derivative of $f(x)=3^{-x}$. When I use different "formlas" I always get a different result. For eg. first I tried using the formula $$y=a^x$$ $$\dot {y}=a^xlna$$ which results in $\dot {y}=3^{-x}ln3$.
After that I tried rewriting it as $f(x)=\frac {1}{3^x}$ and applied the same formula which resulted in $\dot {y}=\frac {1}{3^xln3}$.
I also tried using the formula$$y=(\frac {a}{b})^x$$ $$\dot {y}=(\frac {a}{b})^xln(\frac {a}{b})$$ which results in $\dot {y}=(\frac {1}{3})^xln(\frac {1}{3})$
I know the answer should be $\dot {y}=-3^{-x}ln3$, but I can't seem to get to that result using the formulas. Does that mean the formulas are not correct? And how can I get to the correct result?
The thing about formulaic solutions such as "if $y=a^x$, then $\dot y = a^x \ln a$," is that they have to be applied exactly as written. You may substitute any reasonable constant number for $a$ (where "reasonable" in this case means "positive," so that the log will be defined), but that is all you can do with this formula.
So, given $y = 3^{-x},$ your first attempt, substituting $a = 3,$ fails because then $a^x = 3^x,$ not $3^{-x}$ as required. Indeed this substitution tells us that if $y = 3^x$ then $\dot y = 3^x \ln 3,$ but that wasn't the problem you wanted to solve.
Your second attempt, writing $y = \frac 1{3^x},$ does not match the rule at all, since the rule requires $y = a^x$ and not $y = \frac 1{a^x}.$ The application of the rule after that point is simply false.
The second attempt was close, however. You just needed to see that $\frac 1{3^x} = \left(\frac 13\right)^x,$ which allows you to write $y = f(x) = \left(\frac 13\right)^x,$ at which point you would have a very good chance to apply the formula for $y = a^x$ correctly.
As already pointed out in another answer, the third attempt, with the substitution $\frac ab = \frac 13,$ was completely successful. You just needed to finish simplifying the result, using the fact that $\ln\left(\frac 13\right) = - \ln 3$ as well as the fact (which you had already used once) that $3^{-x} = \left(\frac 13\right)^x.$
As an aside, I'd like to observe that the rule "if $y=\left(\frac {a}{b}\right)^x$ then $\dot{y}=\left(\frac {a}{b}\right)^x \ln\left(\frac {a}{b}\right),$" while it is a perfectly good rule, is practically the same rule as "if $y=a^x$, then $\dot y = a^x \ln a$." That is, the only difference in the rules is that in one rule we have a constant written $a$ and in the other we have a constant written $\frac ab.$ One of the things you can do with rules like this (while still using them "exactly as written") is to replace a constant written one way with a constant written a different way. You just need to be sure you change the constant everywhere in the formula without missing any place where it occurs.