A new (nonrelativistic) model for electron-beam dynamics in a free-electron laser undulator was formulated using the method of linear invariants of quantum-mechanical charge particle. The magnetic field varies periodically along the undulator. We obtained an exact solution for this quantum-mechanical problem described by quadratic Hamiltonian. The time-evolutions of the tree independent quantum fluctuations [cov(q,p), var(q), and var(p)] of the electrons were determined. The quantum behavior shows covariance states which are different from the well-known coherent and squeezed states. On the basis of the quantum approach applied here, further exploration of Madey formula for Δλ of emitted photons was done and the low limit of the electron energy was determined, below which the quantum uncertainty prevails the energy spread of the beam.