The diagonals of a square are equal and bisect each other at right angles.
Therefore, angle APB is a right angle and the triangle APB is an isosceles right triangle with sides of 1.
By Pythagoras' Theorem:
x^2 = 1^2 + 1^2
x^2 = 2
x =sqrt(2) = 1.41421.....