Let us start by setting the terminology right: To locate a point on a plane you need two coordinates ( an X-value and a Y-value). If the point is in space, you need a third coordinate which may be called z, but let's us not complicate things unecessarily.
With just two coordinates, we will be able to locate at best one point.
Let us rephrase the problem: When given two sets of coordinates, how to calculate the distance between the two points.
Let (x1,y1) and (x2,y2) be the coordinates of two points in a plane. To calculate the distance between the points, one uses the formula
d (distance)= square root of ( (x2-x1)^2+(y2-y1)^2)
When you calculate the distance you must substitute actual coordinates for X1, Y1, X2 and Y2.
As regards the bearing, I am afraid that I am no expert in maritime nor in aircraft navigation and I will not venture stray out of my area of competence. However, I know that you need an axis that defines the direction with respect to which angles are measured.
If your reference axis is the horizontal axis on a cartesian plane you can determine the angle that the line joining the points makes with that horizontal axis by calculating its cosine, then extract the arcosine.
If (X2-X1) and (Y2-Y1) are both positive then cos(theta)=(X2-X1)/d, where d is the distance (positive value) calculated above.
×