12 miles.

In the morning, rowing at 2 miles per hour, they rowed for 6 hours. In the afternoon, rowing at 4 miles per hour, they rowed for 3 hours. QED.

There are a number of ways of working this out, and here are two of them:

__Method 1__

If we assume the distance the rowed upstream to be D miles, we know the morning took (D ÷ 2) hours, and the afternoon took (D ÷ 4) hours, with a difference of 3 hours. So:

D D 3

- - - =

2 4

Multiplying throughout by 2, and then 4, gives:

4D - 2D = 24

So:

2D = 24

And:

D = 12 miles.

They rowed 12 miles upstream. QED.

__Method 2__

If we assume they rowed for H hours upstream, we know they travelled H x 2 miles in the morning. In the afternoon they rowed for (H - 3) hours, and travelled (H - 3) x 4 miles. We know these distances are the same, so:

2H = (H - 3) x 4

Giving:

2H = 4H - 12

Rearranging gives:

12 = 2H

So:

H = 6 hours.

They rowed for 6 hours upstream at 2 miles per hour, which is a total of 12 miles. QED.