Here, the vector potential was introduced to a linear magnetohydrodynamics (MHD) simulation code, and the modified and original simulation results were compared. The effects of the broken solenoidal condition on the perturbed magnetic field in linear MHD simulations based on real coordinates were investigated. The results showed that the modified code can successfully remove the error in this condition, and the modified code was confirmed to work appropriately. Incorrect results can be yielded by an error in the condition, especially in analyses of the mode structure.