We can write
y' = 5
as a differential equation:
dy = 5 dx
Integrating both sides gives:
y = 5x + K
Applying the boundary conditions: x = 0, y = 2, we have K = 2 so:
y = 5x + 2