Need help to rotate a math function

I’m making a procedural terrain generator for the BGE and I am having trouble making the equation. I have a sine wave that displaces the mesh one direction and I want another one going perpendicular to it to create mountains. I do not know how to rotate the sine so that it goes perpendicular to the first. BGE Procedural Terrain.blend (1.04 MB) Attached is the blend if you want to look at it. I selected the lines that need the work done on them.

Admins please delete this. It is solved