In stereotactic radiosurgery, a seven-irradiation film was used to define any discrepancy between the beam and target centres. A mathematical model based on the linac alignment and target set-up was developed to diagnose the discrepancies of the seven-irradiation film between the beam and simulation target centres. From the measured data of the multi-irradiation film, this mathematical model leads to five parameters in seven equations. Twin computer codes were employed to solve the five parameters from the seven equations. By feeding the discrepancy data into the two computer codes, the sources of the target-to-beam discrepancy were revealed. From these decoded sources, the target coordinates were adjusted and then the seven-irradiation film procedure was repeated. This discrepancy thus obtained was found to be drastically reduced. Some decoded parameters were consistently verified by direct measurements. This demonstrates that the present mathematical model and computer code do reveal the causes of the target-to-beam misalignment and gantry sag. In a further effort to test the feasibility of the mathematical model and the computer codes, the target's lateral coordinate was deliberately offset by 1.5 mm and then another seven-irradiation film was taken. By inserting these discrepancies into the computer codes, it was found that the deviation was consistent with the intentional offset. In addition, the mathematical model and computer codes are applicable to any multi-irradiation technique.