Step 1: See why we need integration.
The force here is not fixed, it grows as $F = 4x$. When force changes with position, we cannot just do force times distance. Instead we add up tiny bits of work using an integral.
Step 2: Write the work as an integral.
Work is the area under the force versus position graph. \[ W = \int_{0}^{2} F\,dx = \int_{0}^{2} 4x\,dx \]
Step 3: Pull the constant out.
\[ W = 4\int_{0}^{2} x\,dx \]
Step 4: Do the integration.
The integral of $x$ is $\tfrac{x^2}{2}$. \[ W = 4\left[\frac{x^2}{2}\right]_{0}^{2} = 2\left[x^2\right]_{0}^{2} \]
Step 5: Put in the limits.
\[ W = 2(2^2 - 0^2) = 2 \times 4 \]
Step 6: Final value.
\[ W = 8\,\text{J} \] \[ \boxed{8\,\text{J}} \]