We investigate the structural, electronic and optical properties of mixed bromide-iodide lead perovskite solar cell CH$_3$NH$_3$Pb(I$_{1-x}$Br$_x$)$_3$ by means of the virtual crystal approximation (VCA) within density functional theory (DFT). Optimizing the atomic positions and lattice parameters increasing the bromide content $x$ from 0.0 to 1.0, we fit the calculated lattice parameter and energy band gap to the linear and quadratic function of Br content, respectively, which are in good agreement with the experiment, respecting the Vegard's law. With the calculated exciton binding energy and light absorption coefficient, we make sure that VCA gives consistent results with the experiment, and the mixed halide perovskites are suitable for generating the charge carriers by light absorption and conducting the carriers easily due to their strong photon absorption coefficient, low exciton bindign energy, and high carrier mobility at low Br contents. Furthermore analyzing the bonding lengths between Pb and X (I$_{1-x}$Br$_x$: virtual atom) as well as C and N, we stress that the stability of perovskite solar cell is definitely improved at $x$=0.2.