Take a triangle OAP. Pick your coordinate system such that O is at the origin and A is on the x-axis. Let P have coordinates (x,y) and let |OA|=a, |OP|=b and |AP|=c. Let [itex]\theta[/itex] be the angle between OP and the x-axis.
Express x and y in terms of [itex]\theta[/itex] and compute c using the pythagorean theorem.