The function \( f(x) \) is the difference of two greatest integer functions. Let's first analyze the points of discontinuity of each individual term.
Step 1: Points of discontinuity of \( \left\lfloor \frac{x^2}{2} \right\rfloor \).
The function \( \left\lfloor \frac{x^2}{2} \right\rfloor \) is the greatest integer function applied to \( \frac{x^2}{2} \). This function is discontinuous whenever \( \frac{x^2}{2} \) is an integer.
Thus, we need to solve the equation:
\[
\frac{x^2}{2} = k, \quad k \in \mathbb{Z}.
\]
Multiplying both sides by 2, we get:
\[
x^2 = 2k.
\]
This equation has a solution when \( k = 0, 1, 2, \dots \), for values of \( x \) in the interval \( [0, 4] \). The corresponding values of \( x \) are:
\[
x = 0, \sqrt{2}, 2, \sqrt{6}.
\]
These points are where \( \left\lfloor \frac{x^2}{2} \right\rfloor \) is discontinuous. So the discontinuities for this part occur at \( x = 0, \sqrt{2}, 2, \sqrt{6} \).
Step 2: Points of discontinuity of \( \left\lfloor \sqrt{x} \right\rfloor \).
The function \( \left\lfloor \sqrt{x} \right\rfloor \) is the greatest integer function applied to \( \sqrt{x} \). This function is discontinuous whenever \( \sqrt{x} \) is an integer.
Thus, we need to solve the equation:
\[
\sqrt{x} = k, \quad k \in \mathbb{Z}.
\]
Squaring both sides, we get:
\[
x = k^2.
\]
The integer values of \( k \) for \( x \in [0, 4] \) are \( k = 0, 1, 2 \), giving the points \( x = 0, 1, 4 \).
Step 3: Combine the discontinuities.
The total number of points of discontinuity is the union of the points where \( \left\lfloor \frac{x^2}{2} \right\rfloor \) and \( \left\lfloor \sqrt{x} \right\rfloor \) are discontinuous. The points of discontinuity are:
\[
x = 0, \sqrt{2}, 2, \sqrt{6}, 1, 4.
\]
These are 6 points. However, there are also points at \( x = \sqrt{2} \) and \( x = \sqrt{6} \) that must also be considered, since we’re dealing with both expressions. We have now:
- \( x = 0, \sqrt{2}, 2, \sqrt{6}, 1, 4 \).
Thus, the correct number of discontinuities is 8.
Thus, the number of points of discontinuity of \( f(x) \) is:
\[
8.
\]