Why is dG = dH − TdS? I get that $G=H-TS$ because then: $$\begin{align}\mathrm dG&amp;=\mathrm dH-T\,\mathrm dS-S\mathrm dT\\&amp;=T\,\mathrm dS+V\,\mathrm dp-T\,\mathrm dS-S\,\mathrm dT\end{align}$$
Therefore, by cancelling: $\mathrm dG=V\,\mathrm dp-S\,\mathrm dT$ which is the equations for $\mathrm dG$. However, I can’t get this result from using $\mathrm dG=\mathrm dH-T\,\mathrm dS$.
$$\mathrm dH=S\,\mathrm dT+V\,\mathrm dp$$
$$\mathrm dG=\left(S\,\mathrm dT+V\,\mathrm dp\right)-T\,\mathrm dS$$
This does not give me the right equation. Where am I going wrong?
Why is dG=dH-TdS?


It isn't. That would only be true at constant temperature. In general:

$$\mathrm{d}G = \mathrm{d}H - T\,\mathrm{d}S - S\,\mathrm{d}T$$