determine an expression for f(x) in which f(x) is cubic, f(x) >= 0 when x <= 2, f(x) < 0 when x > 2 and f(0) = 4.

recall that y=x^3 has a single intercept at x=0

we want a single intercept at x=2
so start with
y = (x-2)^3
But that is negative for x<2. So now try
y = (2-x)^3
But y(0) = 8, and we want y(0) = 4. So we wind up with
f(x) = 1/2 (2-x)^3