Exact density matrix elements for a driven dissipative system described by a quadratic Hamiltonian