In this thesis we have studied the physics of different ultracold Bose-Fermi mixtures in optical lattices, as well as spin 1/2 fermions in a harmonic trap. To study these systems we generalized dynamical mean-field theory for a mixture of fermions and bosons, as well as for an inhomogeneous environment. Generalized dynamical mean-field theory is a method that describes a mixture of fermions and bosons. This method consists of Gutzwiller mean-field for the bosons, and dynamical mean-field theory for... Mehr