It is still in controversy whether the transition metal doped TiO
2will generate room temperature ferromagnetism and where its magnetism originates from. In order to solve this problem, in this paper we use the GGA+U method based on density functional theory to conduct a first-principle study of the magnetic and optical properties for each of the systems of Ti
0.875
X
0.125O
2,
X= Cr, Mn, Fe, Co. We calculate the ground state energy of each system, on the supposition that they are ferromagnetic or antiferromagnetic. After comparison, the ferromagnetic state is speculated to be its ground state. The binding energy and magnetism calculation results show that Ti
0.875Cr
0.125O
2has the best stability in all doped systems, that the transition metal element doped TiO
2system has a net magnetic moment, and that the doped systems are ferrimagnetic. In comparison, the net magnetic moment produced by Cr, Mn and Fe doped with TiO
2are substantial, showing that these three systems have good ferromagnetic properties. The Curie temperatures of all doped systems are above room temperature, which is of great significance for the electron spin to retain the information in dilute magnetic semiconductors (DMS), and also greatly helps with the practical application of magnetic materials. The analysis of the energy band structure reveals that intrinsic TiO
2is non ferromagnet, Ti
0.875Cr
0.125O
2and Ti
0.875Mn
0.125O
2maintain semiconductor properties, and Ti
0.875Fe
0.125O
2and Ti
0.875Co
0.125O
2exhibit metal characteristics. The doped systems produce room temperature ferromagnetism, the main magnetic source is the transition metal elements (Cr, Mn, Fe, Co) 3d electron orbit induced polarization of the surrounding O-2p state spin electrons, causing the systems to produce a net magnetic moment and be ferromagnetic. The absorption spectrum of the doped system is red-shifted, which shows that the doping causes the range of its absorption spectrum to extend to the visible range. At the same time, in all the doped systems in this article, Fe and Co doped TiO
2have the best light absorption intensity, and the magnetic property of the Fe doped system is the strongest, which indicates that when the system is ferromagnetic, the spin up and spin down splitting will occur in the local magnetic field, which will change the electronic structure of TiO
2and enhance its photocatalytic performance. The calculation results in this paper are of theoretical significance for preparing TiO
2with curie temperature above room temperature by
being dopedwith transition metal elements of Cr, Mn, Fe, and Co.