If we call the cost C then Cecil has to mark the product up 40% of C. That means he needs to charge the whole cost (100%) + 40% of the cost.
That is 140% of C. This amount needs to be $20.
In an equation we have 140% of C which can be written [tex]( \frac{140}{100} )C[/tex] set equal to $20. We solve for C which is the cost or what Cecil should pay for a hat.
[tex](\frac{140}{100} )C=20[/tex]
[tex](\frac{7C}{5} )= \frac{20}{1} [/tex]
This is a proportion so we cross-multiply to solve:
[tex]100=7c[/tex]
[tex] \frac{100}{7} =C[/tex]
C=$14.29