Here are a couple of images that document the math needed to understand. Part I shows the geometry, part II steps through the math. I can't help you if you don't understand Trigonometry, that requires a course.
You don't need the range X. It doesn't matter, if you have the speed of the ship correct and you really are at AoB of 90 degrees. And if your torpedo goes at the rated speed.
(In reality range does matter, because there is a curve in the torpedo's path, unless you have the sub pointed down the torpedo track.)