The transition from fossil fuel-powered buses to electric buses has emerged as a central concern in recent years. Governments worldwide are urging this shift in major urban centers as a strategic response to ecological challenges, particularly issues related to pollution and carbon emissions. The primary impediment to the electrification transition lies in real-world financial constraints. Consequently, comprehending both the ecological benefits and financial intricacies of transitioning bus fleets is paramount.In the initial section of this paper, we formulate a mathematical model to assess the reduction in carbon emissions and pollution resulting from a complete transition of the bus fleet. This model is then applied to the city of Sendai, Japan. By comparing the carbon dioxide and emission gases released by conventional buses with those emitted by electric buses, we can discern the impact of employing electric buses on the urban ecological environment.Moving on to the second section, we present a mathematical model delineating the financial aspects of the transition. We use Sendai as a real-world exemplar for our model. The economic model is categorized into expenditures and revenues. Expenditures encompass the acquisition of electric buses, maintenance costs, and carbon taxes. On the income side, we consider bus fares, revenue from bus advertising, the budget of the bus company, and government subsidies. By subtracting expenditures from revenues, we can ascertain the financial ramifications of transitioning to electric buses.Following the evaluation from both ecological and financial perspectives of the bus fleet's electric transition, a third model is constructed mathematically to address the optimal planning solution for a city aiming to fully electrify its bus fleet within a decade. The objective is to achieve cost-efficiency: to be the most economical while meeting ecological goals. Finally, the cities of Sendai, Kunshan, and Nashville serve as subjects for our model, each providing a tailored solution to the transition planning.