Here's one method to find P
Construct a circle with a center at (0,0) with a radius of sqrt (10)
The equation of this circle is x^2 + y ^2 = 10 (1)
Similarly.....at B construct a circle with a radius of 3sqrt (2) = sqrt (18)
The equation of this circle is x^2 + ( y-4)^2 = 18 (2)
Subtracting (1) from (2) we have that
( y - 4)^2 - y^2 = 8 simplify
y^2 - 8y + 16 - y^2 = 8
-8y + 16 = 8
-8y = -8 → y = 1
And to find x we have that
x^2 + (1)^2 = 10
x^2 + 1 =10
x^2 = 9 take the positive root
x = 3
So P = ( 3,1)
Using the distance formula
CP = sqrt [( 5-3)^2 + ( 1 - 0)^2 ] = sqrt [ 2^2 + 1^2 ] = sqrt (5)