The crystal structure, elastic constant, band structure and density of states of the (Ti1-xMx)B2 ternary coatings (M=Al, Ni, Zr) obtained by doping metal elements in the lattice of TiB2 are calculated by the first principles based on the density functional theory. The results show that when Ti atoms in the lattice of TiB2 are partially replaced by Al, Ni and Zr atoms, the cell volume and the binding energy of the (Ti1-xMx)B2 ternary coatings increases. With the increase of dopants, the structural stability of (Ti1-xMx)B2 ternary coating decreases. The binding energy proves to be positive when the content of dopant Al reaches 3 % and that of Ni is more than 13 %. However, the binding energy is still negative even that of Zr is more than 25 %. The dopants (Al, Ni and Zr) reduce the hardness (7.7 %, 10 % and 8.6 %, respectively) and improve the toughness of the TiB2 coating (4.7 % reduction in G/B ratio). Due to more obvious weakening of the orbital hybridization of Ti(Ni) and B atoms, Ni-doping has more significant effect on reducing the hardness of TiB2 coating.