A general method to construct basis functions for fermionic systems which possess the U(1), SU(2) and Sf symmetry is presented. We use this method to derive the analytical expression for the ground state energy of the Hubbard model with unconstrained hopping at half filling and for arbitrary lattice sites.