We study the trajectory of basketball based on nonlinear differential equations. At the same time, we design the optimal plan for shooting. We discuss the effect of the distance between the center of the ball and the center of the basket when shooting, the height of the center of the ball, and the change in the speed of the ball on the ball hit rate. The article comprehensively solves its motion trajectory. At the same time, we use the meaning of derivatives to find the maximum value of variables such as required height and speed. Research to find the best shooting spot and shooting angle.