4B. Let $n$ be a natural number. How many different solutions $(x, y) \in \mathbb{Z} \times \mathbb{Z}$ does the inequality $|x|+|y| \leq n$ have?
Solution. The graph of the function $|x|+|y|=n$ is a square with vertices $(n, 0)$, $(-n, 0)$, $(0, n)$, and $(0, -n)$ (see diagram).

Let's see how many integer solutions this equation has for specific values of $n$.

For $n=0$, it has one solution.

For $n=1$, it has 4 integer solutions.

For $n=2$, it has 8 integer solutions.

For $n=3$, it has 12 integer solutions, etc.

Obviously, for $n=k$, the equation $|x|+|y|=k$ has $4k$ integer solutions.

![](https://cdn.mathpix.com/cropped/2024_06_05_84ab8bb1a5b8361dd462g-11.jpg?height=646&width=682&top_left_y=278&top_left_x=798)

From the above, it is clear that the number of integer solutions to the inequality $|x|+|y| \leq n$ is equal to the sum of the integer solutions of the equations

$$
|x|+|y|=k, \quad k=0,1,2, \ldots, n
$$

and this sum is

$$
1+4+8+12+\ldots+4n=1+4(1+2+\ldots+n)=1+2n(n+1)
$$