In this work, the design of a hydrogen production system was optimized for Algiers in Algeria. The system produces hydrogen by electrolysis using a photovoltaic (PV) generator as a source of electricity. All the elements of the system have been modeled to take into account practical constraints. The cost of producing hydrogen has been minimized by varying the total power of the photovoltaic generator. An optimal ratio between the peak power of the PV array and the nominal power of the electrolyzer was determined. Photovoltaic module technology has been varied using a large database of electrical characteristics. It was noted that PV technology does not have a very significant impact on cost. The minimum cost is around 0.44$/N m3, and the power ratio in this case is 1.45. This results in a cost reduction of around 12% compared to a unit ratio. The power ratio and cost are linearly dependent. Only a small number of technologies give a relatively low cost of about 0.35$/N m3. These generators are interesting; however, we assumed an initial cost of $2.00/Wp for all technologies. In addition, it was noted that it is possible to increase hydrogen production by 10% by increasing the power of the photovoltaic generator, the extra cost in this case will only be 0.1%.