The optical properties of thermally annealed TiO_2 samples depend on their preparation process, and the TiO_2 thin films usually exist in the form of anatase or rutile or a mixture of the two phases. The electronic structures and optical properties of anatase and rutile TiO_2 are calculated by means of a first-principles generalized gradient approximation(GGA) +U approach. By introducing the Coulomb interactions on 3d orbitals of Ti atom(U^d) and 2p orbitals of O atom(U^p), we can reproduce the experimental values of the band gap. The optical properties of anatase and rutile TiO_2 are obtained by means of the GGA+U method, and the results are in good agreement with experiments and other theoretical data. Further, we present the comparison of the electronic structure, birefringence, and anisotropy between the two phases of TiO_2. Finally,the adaptability of the GGA+U approach has been discussed.