In general, b can be any value. For our present proof, we choose b < a.
Take a square ABCD of side a. Its area is a². Mark K and F on AB and AC respectively at distance b. Draw lines perpendicular to AB and BC from K and F respectively to meet at E. KBFE is a square with side equal to b. Its area is b².
Now mark all sides and segments. FC = a-b = GE = EH = HD. So DHEG is a square with side (a-b). Its area is (a-b)².
There are two rectangles HAKE and GEFC. Each of them has sides (a-b) and b. Their areas are b(a-b) = ba - b².
Now, Area of ABCD = Area of HAKE + GEFC + KBFE + DHEG
a² = ba - b² + ba -b² + b² + (a-b)²= 2ab - b² + (a-b)²
using standard algebra we get, (a-b)² = a² + b² - 2 a b