The equation that gives the speed of the boat after David has rowed for x hours is y=4-1.5x.
The direction David is rowing (upstream) is the positive direction. That makes the direction the river is flowing negative.
David rows at 6 mph, but the river is flowing at 2 mph in the opposite direction. That means his "net" speed, relative to an observer on the ground, is 6-2 = 4 mph.
He loses 1.5 mph of his speed every hour, so after x hours, his speed is 4-1.5x.