To solve this problem you must follow the proccedure shown below:
 1. You have that the pasture must contain 128 square meters and no fencing is required along the river. Then:
 A=LxW
 A is the areaÂ
 L is the lenght
 W is the width
 2. Let's clear W:
 W=A/L
 W=128/L
 3. The formula of the perimeter is:
 P=2L+W
 P=2L+(128/L)
 4. Now, you must derivate:
 dP/dL=0
 2+(128/L²)=0
 L=8 meters
 W=A/L
 W=128/8
 W=16 meters