Step 1: Prove the forward direction first (perpendicular implies the identity):
If $\vec a\perp\vec b$, then $\vec a\cdot\vec b=0$ by definition of perpendicular vectors. Then $(\vec a+\vec b)\cdot(\vec a+\vec b)=|\vec a|^2+2(0)+|\vec b|^2=|\vec a|^2+|\vec b|^2$, so the identity holds.
Step 2: Prove the reverse direction (the identity implies perpendicular):
Assume $(\vec a+\vec b)\cdot(\vec a+\vec b)=|\vec a|^2+|\vec b|^2$. Expanding the left side gives $|\vec a|^2+2\vec a\cdot\vec b+|\vec b|^2$, so equating with the right side forces $2\vec a\cdot\vec b=0$, hence $\vec a\cdot\vec b=0$.
Step 3: Conclude perpendicularity from the zero dot product:
Since neither vector is zero, $\vec a\cdot\vec b=|\vec a||\vec b|\cos\theta=0$ can only happen if $\cos\theta=0$, so $\theta=90^\circ$, meaning $\vec a\perp\vec b$.
Final Answer:
Both directions hold, proving the "if and only if" statement.
\[ \boxed{\text{Proved both ways}} \]