We have to use the sine to find PS due to the fact that the triangle PRS is a right triangle.
Then:
[tex]\begin{gathered} cos45\text{ = }\frac{RS}{PS} \\ \frac{\sqrt{2}}{2}=\text{ }\frac{18}{PS} \\ \sqrt{2}\text{ = }\frac{36}{PS} \\ PS=\text{ }\frac{36}{\sqrt{2}} \\ PS=\text{ }\frac{36\sqrt{2}}{2} \\ PS=\text{ 18}\sqrt{2} \\ \\ \end{gathered}[/tex]