There are 4 seperate walks here which add up to the total distance. Set each to a variable
total distace = t
morning = m
after lunch = l
afternoon = a
after dinner = d
your equation then is t=m+l+a+d
we know that d = 3 miles
If the man walks half the total distance in the morning
m=1/2t
If he walks half of the remaining distance after lunch
l=(1/2)1/2t or 1/4t
If he walks 1/2 the remaining distace in the afternoon
a=(1/2)1/4t or 1/8t
and we know that the final distance is 3 miles
Now we can plug in the values for all of the variables since we have only t left
m+l+a+d=t
1/2t+1/4t+1/8t+3=t
combine all the t terms on the left
7/8t+3=t
subtract 7/8t from both sides
3=1/8t
multiply both sides by 1/8
t=24 miles