Stand-alone renewable energy systems implemented in residential areas reduce the magnitude of the crisis by means of lowering the electrical demand and associated costs of generation and distribution. Further steps can be taken to optimize the operation of these systems in order to improve their energy consumption. The development and application of optimization algorithms to existing and/or new setups can potentially improve electrical power consumption for hybrid arrangements while making the best use of renewable energy. This will not only reduce the energy cost to the consumer, but also reduce the greenhouse gasses produced by electricity suppliers. Therefore, this paper focuses on developing a mathematical model to minimize the electrical energy cost of the hybrid solar collector/electric water heating system through optimal switching control of an electric resistive water heater with the aim of increasing the efficiency of the overall energy consumption of the system whilst maintaining thermal comfort level of the user.