Motion of an object is defined as the change in position of the object with respect to its surroundings. If the object does not change their position with respect to their surroundings, which is said to be at rest.
Distance: Distance is a scalar quantity. The length of actual path followed by an object between its initial and final position is called distance. There is no directional component to a distance measurement.
Displacement:Displacement is a vector quantity. It is independent of actual path followed by an object but depends only on the distance between initial and final position.
This is a best example to visualize what's the difference between Distance and Dispalcement.
Calculating Distance and Displacement:
Here I want to illustrate the concept of distance and displacement.
From the Figure, If I walk $3m$ west and turn to $4m$ north. Then easily to calculate the distance what I traveled.
i.e. $3m$ + $4m$ = $7m$.
This $7m$ is just only a distance what I traveled and no need to explain the direction of travel.
But, to determine Displacement; first of all I can draw an arrow where I started walking and extends to the point where I stopped walking.
From the Pythagorean Theorem: $a{^2}$ + $b{^2}$ = $c{^2}$. Since $c^2$ is our displacement squared; it should be written as: $(\Delta S){^2}$.