Note that for our rays: Rin = -Rd
The projection of Rin onto N is N cos (q) so
Rout = N cos(q) + S
Rin + S = N cos(q)
S = N cos(q) - Rin
Rout = 2Ncos(q) - Rin = 2N(N ¸ Rin) - Rin