A theoretical study of Al 1−x Ga x N, based on the full-potential linearized augmented plane wave method, is used to investigate the variations in the bandgap, optical properties, and nonlinear behavior of the compound with the change in the Ga concentration. It is found that the bandgap decreases with the increase in Ga. A maximum value of 5.50 eV is determined for the bandgap of pure AlN, which reaches a minimum value of 3.0 eV when Al is completely replaced by Ga. The static index of refraction and dielectric constant decreases with the increase in the bandgap of the material, assigning a high index of refraction to pure GaN when compared to pure AlN. The refractive index drops below 1 for higher energy photons, larger than 14 eV. The group velocity of these photons is larger than the vacuum velocity of light. This astonishing result shows that at higher energies the optical properties of the material shifts from linear to nonlinear. Furthermore, frequency dependent reflectivity and absorption coefficients show that peak values of the absorption coefficient and reflectivity shift toward lower energy in the ultraviolet ͑UV͒ spectrum with the increase in Ga concentration. This comprehensive theoretical study of the optoelectronic properties predicts that the material can be effectively used in the optical devices working in the visible and UV spectrum.