Every point went up 4 units and left 3 units.
Point X on the triangle moved up 4 and left 3. That formed a right triangle with legs 4 and 3. The distance point X moved to point X', d, is the hypotenuse of the right triangle.
Using the Pythagoras Theorem
3^2+4^2=d^2
d = 5