In this work, we present a stable algorithm for the inverse problem of identifying cortical sources from electroencephalographic measurements on the scalp. This inverse problem is ill-posed due to the numerical instability it presents, i.e., small changes in the measurements can produce large variations in the location of the sources. A boundary value problem is used to find correlations between the sources and measurements. In the case in which the head is modeled using two concentric spheres. We use spherical harmonics to find the solution to the inverse source cortical problem. To handle the numerical instability of this problem, we use the Tikhonov regularization method and a cut-off of the harmonic expansion series. From numerical tests, we found these parameters with which we get good approximations. Finally, we illustrate the algorithm proposed with synthetic examples