How can do we show that the shortest distance between two sets is always the vector that is perpendicular to both sets?

I remembered it went through inner products, but it's not working for me.

So, if i had

<g-f,g-f>= <g,g> - 2 <g,f> + <f,f>

where g,f are column vectors of with n being finite.

I got stuck at that part.

I also rewrote it as

<g-f,g-f>= <g,g>-2*||g||*||f|*cos( |)+<f,f>

But I'm missing something really important.

And out of curiosity, is this true for all vectors? Or is it only true for column vectors?