Problem 1.
But this is a simple problem! Setting distance'[theta] equal to zero reduces our problem to finding an angle theta so that the squares of its sine and cosine are equal. Since common sense says our angle must be between 0 and Pi/2, this angle is Pi/4.