I know what the Pythagorean theorem is, I implemented it in the program to account for differences in depth because trilateration with three known points only works in 2 dimensions.
It's stuff like this
https://www.101computing.net/wp/wp-content/uploads/trilateration-formula-2.png
And this
https://www.101computing.net/wp/wp-content/uploads/trilateration-formula-3a.png
That I can't quite wrap my head around