<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] As you have written $$(a^u)' = u' \cdot a^u \cdot \ln a$$ so :$$(a^{ u })'=u'\cdot a^{ u }\cdot \ln { a } ={ \left( 7^{ x^{ 2 }-x } \right)  }^{ \prime  }={ \left( { x }^{ 2 }-x \right)  }^{ \prime  }7^{ x^{ 2 }-x }\ln { 7 } =\left( 2x-1 \right) { 7 }^{ { x }^{ 2 }-x }\ln { 7 } $$
</s>