So distributive property of multiplication says
a(b+c)=(ab)+(ac)
so 2/3(6x+12)=((2/3)6x)+((2/3)12)=12/3x+24/3=4x+8=4(x+2)
So to set up this equation, you have to do
Time1*Workers1=Time2*Workers2
In this case, Time1=24 days, Workers1=15 electricians, and Workers2=18 electricians, and we have to solve for Time2
Thus we get 15*24=18*Time2
Time2=15*24/18=20 days