Solving three dimensional problems using trigonometry