Relationship between short-run marginal cost(SRMC) and long-run marginal cost(LRMC)
First, fix an output level $y^*$. Now you solve the (long run) cost-minimization problem conditional to this output level. We obtain the cost function $c(y)$ and the conditional demand function $k(y)$.

Suppose we are at a cost-minimizing size of plant, $k(y^*)=:k^*$, for this output level. If costs decreased when you increase plant size, then it would pay to increase plant size. This contradicts our choice of plant size. Likewise, if cost increases when you increase plant size, then it would pay to decrease plant size. Again, this contradicts our choice of plant size. So, $$\left(\frac{\partial c(y)}{\partial k}\right)_{y=y^*,k=k^*}=0.$$

The calculus treatment is already given in the mentioned page. Let me know if there is still something that bugs you.