It is a typical example in Coase Bargaining.
Important concept: once the , the trade could happen.
In this Rancher and Farmer Bargaining case, a ranch and a farm are adjacent. The contradiction is that the cattle raised on the ranch can damage the crops grown on the farm.
And the table is here:

An important concept is that, who has the right?
Lets do as the thinking procedure list in the Coase Bargaining. We found that the social optimum happens when the number of steers is 2. (Social Gains 2)
Rancher has the right
If rancher has the right, and without Bargaining, of course he would raise 4 steers, which is definitely inefficient.
And the farmer could reduce the lost by Bargaining, for example, to reach the efficient case, the would be , and the for the rancher would be ,since , the Bargaining could happen.
Farmer has the right
If farmer has the right to put an injunction on raising steers, the method is similar.
Move forward: If we can build a fence…
Suppose a fence costs \7$ to prevent damages to the crops.

Above is the new situation. The efficient situation becomes when the number of steers is 4.
If farmer has the right
Just like we analyzed before, the farmer could put an injunction. Without bargaining, the rancher raise no steers. Now he wants to “buy” the right to raise steers. So his would be ,
Wonderful thing: the of the farmer is not ! It is since he could build a fence by himself!
Think about what is a fence costs \9$ ?