Given a particle with mass $m$ moving at velocity $v$, total energy is:
$$E^2 = (pc)^2 + (mc^2)^2$$
Note I am not using the relativistic - rest mass convention, as I was taught to think in terms of rest - total energy instead. "Relativistic mass" would be represented as $\gamma m$ , where the mass of the particle is being changed by a factor of $\gamma$ depending on it's relative velocity $v$, where gamma is equal to,
$$\gamma = \frac{1}{\sqrt{1-(v/c)^2}}$$
To obtain momentum of Particle, we expand the original equation to account for relativistic momentum:
$$E^2 = (\gamma mvc)^2 + (mc^2)^2$$
If the above equation is an accurate representation of the energy-momentum relationship, how does my professor use this equation to derive $E=pc$ for a photon? He says for a massless particle (photon),
$$E^2 = (pc)^2 + ((0)c^2)^2$$
therefore,
$$E = pc$$
But he appears to me to neglect the fact that you can expand the $p$ variable into relativistic momentum, which is a function of mass, gamma, and velocity. Was his move acceptable? If so , why? How can you make one mass 0 but not the other?