In this dissertation, we investigate the divergence-free discontinuous Galerkin method using the $\mathcal{H}$(\textbf{div}) basis, to solve the nonlinear ideal magnetohydrodynamics (MHD) equations. This is a novel approach to ensure the divergence-free condition on the magnetic field. The idea is to add on each element extra bubble functions from the same order hierarchical $\mathcal{H}$(\textbf{div})-conforming basis to reduce the higher order divergence, and then extra constant edge functions to remove the constant term of divergence. As a consequence, this method has a smaller computational cost than the traditional discontinuous Galerkin method with standard piecewise polynomial spaces. We formulate the discontinuous Galerkin method using the $\mathcal{H}$(\textbf{div})-conforming basis and perform extensive two-dimensional numerical experiments for both smooth solutions and solutions with discontinuities. The computational results show that the global divergence is largely reduced, but with a relatively small increase in the error of the numerical solution itself.