$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?