This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
Please check the picture to understand the solution better.

The Pythagorean Theorem which applies to right triangles states that:
a and b are the lengths of the legs while c is the length of the hypotenuse.

In the Cartesian plane they are:

The points are have coordinates (x,y)

This means
 (x_a,y_a) are the coordinates of the first point 
and (x_b,y_b) are the coordinates of the second

So in the problem:
(x_a,y_a)=(2,-2) which are the coordinates of P
(x_b,y_b)=(-1,2) which are the coordinates of P

We substitute this to the Pythagorean theorem
9+16=c^2 \\ 25=c^2 \\ 5=c

The triangle that will be formed has a very common Pythagorean triple which is (3,4,5).

The length of the hypotenuse (or any length of a side) cannot be less than or equal to 0 so it cannot be -5.

Therefore the length of the line segment when you connect the two points is 5.