If $a$ and $b$ are perpendicular to each other.
Then, $a \cdot b =0\,\,\,\,\,\,\,\,\,...(i)$
$\because ( a + b ) \perp( a +m\, b )$
$\therefore ( a + b ) \cdot( a +m \,b )=0 $
$\Rightarrow a \cdot a +m\, b \cdot b + b \cdot a +m \,a \cdot b =0 $
$\Rightarrow | a |^{2}+m| b |^{2}+0+m \cdot 0=0 \,\,\,\,$[from Eq. (i)]
$\Rightarrow m=-\frac{| a |^{2}}{| b |^{2}}$