Hey there,
I understand what you’re trying to achieve, and if you’re familiar with trigonometry, specifically cosine & sine, you can do so by using the law of cosine deriving from inverse kinematics. Here’s an article explaining in depth of what you’re trying to achieve.