<s>[INST] Finding the derivative of $7^{x^2-x}$ using the chain rule $7^{x^2-x}$
I know there is a formula ($(a^u)' = u' \cdot a^u \cdot \ln a$) for this but I wanted to understand the logic behind that formula so I tried using the chain rule to solve this: 
$$(7^{x^2-x})' = (x^2-x)'\cdot7^{x^2-x-1}\cdot 7' = (2x-1)\cdot7^{x^2-x-1}\cdot0 = 0$$
Then I tried replacing $7^{x^2-x}$ with $(e^x)^{\ln7\cdot(x-1)}$:
$$((e^x)^{\ln 7 (x-1)})' = (\ln 7 (x-1))'  \cdot (e^x)^{\ln 7 (x-1)-1} \cdot (e^x)' = (\ln7) \cdot (e^x)^{\ln 7 (x-1)-1} \cdot e^x = (\ln7) \cdot (e^x)^{\ln 7 (x-1)}  =  (\ln7) \cdot 7^{x(x-1)} =(\ln7) \cdot 7^{x(x-1)}$$
But the right answer is $(\ln7) \cdot 7^{x(x-1)} \cdot (2x-1)$. What did I do wrong?
 [/INST] You can go straight to the chain rule.
Call $f(x)=7^x$ and $g(x)=x^2-x$, then
$$g'(x)=2x-1 \quad \text{and} \quad f'(x)=7^x(\ln 7)$$
so,
$$[f(g(x))]'=g'(x)f'(g(x))=(2x-1)7^{g(x)}(\ln7)=(2x-1)7^{x(x-1)}(\ln7)$$
</s>