When A can do work in 4 days, in 1 day A completes 41 of the work.
When B can do work in 8 days, in 1 day B completes 81 of the work.
A's rate =41 work per day
B's rate =81 work per day
When A and B work together, their rates are added:
Combined rate =41+81
=82+81
=83 work per day
Time =RateTotal Work
=831
=1×38
=38 days
Therefore, A and B together complete the work in 38 days.