Using density functional theory, the electronic structures, lattice constants, formation energies, and optical properties of Al x Ga 1−x N are determined with Al component content x in a range from 0 to 1. As x increases, the lattice constants decrease in e-exponential form, and the band gap increases with a band bending parameter b = 0.3954. The N-Al interaction force in the (0001) direction is greater than the N-Ga interaction force, while the N-Al interaction force is less than the N-Ga interaction force in the (10 10) direction. The formation energies under different Al component content are negative and increase with Al component content increasing. The static dielectric function decreases, the absorption edge has a blue shift, and the energy loss spectrum moves to high energy with the Al component content increasing.