When solution is neutralized it contains equal moles of H+ and OH-, or moles acid = moles base. Molarity (M) is a unit that expresses concentration in moles of solute per liter of solution:
M - moles solute/liters solution, therefore:
moles solute = M x liters of solution
Since moles acid = moles base when neutral,
M x liters of acid = M x liters of base.
We can use any volume unit as long as it's the same unit on each side:
(MxV) of acid - (MxV) of base, or:
M of acid = (MxV) of base/V or acid
M of acid = (0.1M)(54 ml)/(125 ml) = 0.04 M
Notice that this is a monoprotic acid (one H+ per molecule) and a monobasic base (one OH_ per molecule.) If you were solving a similar problem with a acid with more than one H+ per molecule or a base with more than one (OH-) per molecule you would need to multiply each M x V by its number of corresponding particles per mole. For example, if the problem used Mg(OH)2 instead of NaOH, then moles of base would equal (MxV) x 2.