Online education platforms inject new vitality into the field of education, and greatly improves the accessibility to high-quality education resources. However, the current online education platforms do not support independent course selection based on personal preferences. To solve this problem, this paper designs an automatic recommendation method of optimal courses for online math education platforms based on Bayesian model. The results show that the Bayesian model can simulate the causal relationship between real-world affairs by building a graphic model based on the graph theory and the probability theory; the model can effectively merge priori and posteriori information, and encode the causality between knowledge points; the model clearly outshines user-based collaborative filtering model, term-based collaborative filtering model, and SlopeOne model, and achieves a stable accuracy rate in automatic recommendation of courses. The research provides an empirical evidence to the improvement and innovation of professional online math course platforms.