The governing equations for the electromagnetic waveguide are derived to Hamiltonian system formulation and symplectic geometric form, and transverse electric and magnetic components are treated as dual vectors to each other. By separation of variables, we arrived at a symplectic eigenvalue problem for Hamiltonian operator matrix, which can be solved by adjoint symplectic orthonormal relationship and the symplectic eigenfunction expansion method. A dual edge element is proposed for electromagnetic waveguide with irregular cross section and inhomogeneous loaded materials. Dual edge element can surmount those difficulties related to node-based finite elements in computational electromagnetics, and our numerical examples show that dual edge element has its own merits when compared with regular edge element.