© AI

Educational Technologies

OBTAINING AN ANALYTICAL SOLUTION OF FIRST-ORDER DIFFERENTIAL EQUATIONS WITH CHATGPT

Отворен достъп CC BY-SA 4.0 License

https://doi.org/10.53656/math2026-4-7-oas

Abstract. ChatGPT is a part of the artificial intelligence developed by OpenAI, which was officially launched in 2022. It is a tool that enables interactive conversations and provides explanations, guidance and information across various fields related to everyday life, education and professional work. On the other hand, differential equations are deeply connected to nature and the laws of physics, playing an essential role in the mathematical modelling of real-world phenomena. Therefore, in this paper we analyse ChatGPT’s capability to solve first-order ordinary differential equations, with a focus on obtaining accurate analytical solutions. Our analysis includes the following types of equations: equations with separable variables, linear differential equations, Bernoulli differential equations, and other nonlinear differential equations. Our goal is to assess the accuracy and applicability of ChatGPT in solving this type of mathematical problem through the analysis of various examples.

Keywords: first-order differential equations; ChatGPT; analytical solution of differential equation.

1. Introduction

Differential equations can describe natural processes and physical phenomena, which explains their wide application across various fields. To predict how these processes and phenomena will develop further, we need analytical solutions of differential equations. Finding these solutions is not always an easy task. In order to determine the solution, mathematicians use certain methods developed for certain types of differential equations. Among these methods, techniques of numerical analysis are most commonly employed in the process of solving differential equations in technical sciences.

On the other hand, artificial intelligence (AI) is rapidly developing and is designed to mimic human intelligence. Tools like ChatGPT are available free of charge and are easy to use. ChatGPT is a large language model developed by OpenAI. It is based on a generative pre-trained transformer architecture, generating textual responses in conversations and understanding various topics. Users can log in and interact with it, ask questions, or assign tasks and receive answers. ChatGPT is pre-trained to utilize data and apply it in conversations. Since its introduction, ChatGPT has been constantly developed and upgraded. It has gained considerable popularity, and its use continues to grow.

We have aimed to investigate ChatGPT’s capabilities in solving different types of mathematical tasks. Because mathematics and its results are widely used not only in different math fields, but also in science, engineering, economy, medicine and in everyday life in general, many people use math achievements as basis or auxiliary in their work. Students and teachers, in the process of learning, very often need math support. In recent years AI is frequently used as a support in different kinds of problems, involving math ones. But chatbots’ performances in solving math tasks have not been investigated sufficiently. We can find available results of research how well ChatGPT performs in generating text, but there is still limited research on its mathematical capabilities for solving tasks on academic level. Its training primarily focuses on understanding language and generating text rather than solving mathematical and logical problems. Mathematical problems typically require a deeper understanding of the concepts and a step-by-step reasoning process to provide accurate solutions. Therefore, while ChatGPT has impressive capabilities, it sometimes produces inaccurate answers when used to solve mathematical problems at the academic level. However, since ChatGPT is a pre-trained model, its mathematical abilities can be improved, potentially overcoming some limitations.

There are studies on incorporating artificial intelligence (AI) into education (Albadarin et al., 2024; Firaina et al., 2023; Alafnan et al., 2023; Ausat et al., 2023; Castro, 2023). Rane (2023) explored how educators can leverage the power of AI to enhance individuals' mathematical abilities and better equip them to handle the complexities of the modern world. Shakarian et al. (2023) evaluated ChatGPT on mathematical word problems and found that even in textual tasks, the results and solutions offered by ChatGPT were inaccurate at a high rate. Plevris et al. (2023) compared three chatbots regarding their effectiveness in solving mathematical and logical problems and concluded that while all three models could handle basic mathematical and logical problems due to their training data, their performance on more complex mathematical and advanced logical tasks might be less reliable.

Frieder et al. (2023) investigated ChatGPT's mathematical capabilities and concluded that its problem-solving skills were below the level of an undergraduate student. Koceska et al. (2023) tested the capabilities of ChatGPT for determining numerical solutions of ordinary differential equations and found that it could provide accurate solutions but also made errors, depending on the type of differential equation and the method used for its numerical solution. Koceska et al. (2025) have enlarged their study about ChatGPT performances in evaluating numerical solutions of differential equations and have obtained similar results. Zlatanovska et al. (2024) tested ChatGPT capabilities in determining analytical solution of indefinite and definite integrals.

For this paper, we have tested how good it is in evaluating an analytical solution of first-order differential equations. In this work, we used the free version of ChatGPT 4.0. Our main goal with this research was testing to determine whether it provides an accurate analytical solution to a first-order differential equation. The obtained results can determine the way and the role of using AI as support when someone needs a solution to such differential equations: to what extent can the user rely on ChatGPT’s solution? For this purpose, we gave it 20 tasks and problems of each of the following types of differential equations: separable differential equations, some differential equations that can be transformed (by substitution) into separable, linear differential equations, Bernoulli differential equations, exact differential equations, differential equations with total differential, Riccati differential equations, Clairaut differential equations, Lagrange differential equations, and three types of differential equations that are not reduced by the derivative, and do not belong to any of the previously listed types. The examples and problems can be found in (Celakoski 1986), (Celakoski 1988) and other textbooks on differential equations at the academic level.

2. Analytical solution of first-order differential equations A first-order differential equation has the form

(1) \[ F\left(x, y, y^{\prime}\right)=0 \]

The function \(F\) cannot depend only on \(x\) and/or \(y\); the derivative \(y^{\prime}\) must be present. Form (1) is not the form most commonly used in the natural and the technical sciences. We most often consider a differential equation solved for the derivative, i.e., of the form

(2) \[ y^{\prime}=f(x, y) \]

The transition from (1) to (2) is not always straightforward and may even be impossible in some cases. Its general solution in explicit form is

\[ y=\varphi(x, C) \] or in implicit form

\[ \varphi(x, y, C)=0 \] where \(C\) is an arbitrary constant.

If \(C\) is assigned any admissible value, then a particular solution is obtained.

In many cases, the value of the integration constant \(C\) can be determined by specifying an initial condition \(y\left(x_{0}\right)=y_{0}\), thereby defining a Cauchy problem. The resulting solution is a particular solution to the differential equation. But the value of the constant \(C\), thus a particular solution, cannot always be determined, or uniquely determined with an initial condition. We also tested how ChatGPT handles such cases.

Some differential equations have a solution that is not obtained from the general solution for any value of the integration constant \(C\). Such solutions are called singular solutions. In other words, we will treat the general solution as one in which we will not include the singular solution of the differential equation. Linear differential equations do not have singular solutions, and for them, we will only talk about a general solution.

When we refer to a general solution as valid “for all values of \(C\)”, we mean all admissible values of \(C\), i.e., values for which the solution is well defined and does not involve undefined or non-real expressions.

Our focus will include the following types of differential equations: differential equations with separable variables, including homogeneous differential equations, linear and Bernoulli differential equations, exact differential equations and differential equations with integrating factor, Riccati, Clairaut, Lagrange differential equations and differential equations that are not solved for the derivative.

2.1. Differential equations with separable variables

Differential equations with separable variables are among the most elementary differential equations and have the form \(g(y) y^{\prime}=f(x)\).

After testing it on 20 different examples, we found that ChatGPT gives an exact and accurate solution to this type of differential equations without difficulty, when the variables in the equation are separated. For some more complex differential equations, ChatGPT provides the correct general solution but fails to identify a singular solution. Sometimes, when transformations are required to determine the type of the equation, ChatGPT does not recognize a differential equation with separable variables, and treats it as another type. Thus, errors usually occur during the separation of variables rather than in obtaining the solution once the variables have been separated. However, if an error occurs at any of these steps, the final solution will also be incorrect.

Example 1. For the differential equation \(x d y=\left(y+y^{2}\right) d x\), ChatGPT gives the correct general solution \(y=\tfrac{C x}{1-C x}\), where \(C\) is an arbitrary constant. Figure 1 shows parts of ChatGPT's solution.

But this differential equation has singular solutions \(y=-1, y=0\), and \(x=0\), which ChatGPT fails to identify.

Figure 1. Part of ChatGPT’s solution to a separable differential equation

Example 2. For the Cauchy problem \(2 x y y^{\prime}=y^{2}+1, \quad y(2)=1\), ChatGPT obtains the correct general solution \(y^{2}=C x-1\), where \(C\) is an arbitrary nonzero constant, by solving the equation as a linear differential equation. ChatGPT does not recognize it as a differential equation with separable variables. However, the obtained solution is correct. Figure 2 shows parts of ChatGPT's solution.

ChatGPT successfully recognizes and solves homogeneous differential equations

\[ y^{\prime}=f\left(\tfrac{y}{x}\right), \]

that can be transformed into separable differential equations by the substitution \(\quad u=\tfrac{y}{x}, u=u(x)\). It also successfully recognizes and solves differential equations of the form

\[ y^{\prime}=f(a x+b y+m), \quad a, b, m \in \mathbb{R}, \quad b \neq 0 \] which can be transformed into a separable differential equation with the substitution \(z=a x+b y+m, z=z(x)\).

Figure 2. Part of ChatGPT’s solution to a Cauchy problem

Example 3. The differential equation \((x-1) d y-y d x=0\) has the general solution \(y=C(x-1)\), where \(C\) is an arbitrary constant. Applying the initial condition \(y(1)=0\) yields the equation \(0=C \cdot 0\), thus the constant \(C\) cannot be determined uniquely. Parts of the ChatGPT’s solution are shown in Figure 3.

Figure 3. Part of ChatGPT’s solution to a Cauchy problem which does not have a unique solution

The solution provided by ChatGPT is completely correct.

2.2. First-order linear and Bernoulli differential equations

The first-order linear differential equation has the form

(3) \[ y^{\prime}+a(x) y=f(x), \]

where \(a(x)\) and \(f(x)\) are given functions, continuous on some interval (infinite or finite). For \(f(x) \equiv 0\), equation (3) takes the form

(4) \[ y^{\prime}+a(x) y=0 \]

which is called a homogeneous linear first-order differential equation. Equation (4) can be solved as a separable differential equation. For \(f(x)\) \(\not \equiv 0\), it is called a nonhomogeneous first-order linear differential equation. Thus, throughout this paper, equation (3) refers to a nonhomogeneous first-order linear differential equation. Solving a linear first-order differential equation involves using an integrating factor or Lagrange's method of variation of parameters. ChatGPT successfully recognizes and solves first-order linear differential equations using the previously explained methods.

The Bernoulli differential equation has the form

(5) \[ y^{\prime}+a(x) y=y^{k} f(x), \]

where \(k=\) const, \(k \neq 0, k \neq 1, a(x)\) and \(f(x)\) are given functions, defined and continuous on some interval (infinite or finite). For \(k=0\), equation (5) reduces to equation (3). For \(k=1\), equation (5) reduces to equation (4). Solving a Bernoulli differential equation involves a substitution that transforms it into a linear first-order differential equation. ChatGPT successfully recognizes and solves Bernoulli differential equations.

It only sometimes has difficulties when a transformation of the equation is necessary to reach the form (3) or (5). Indeed, all the recorded errors occurred during the transformation of the given equation into form (3) or (5). Once the equation had been transformed into form (3) or (5), ChatGPT always generated the solution correctly.

2.3. Exact differential equations and differential equations solved by an integrating factor

The differential equation of the form \(M(x, y) d x+N(x, y) d y=0\) is either an exact differential equation when \(\tfrac{\partial M}{\partial y}=\tfrac{\partial N}{\partial x}\) (in a simply connected domain), or a differential equation that can be solved using an integrating factor when \(\tfrac{\partial M}{\partial y} \neq \tfrac{\partial N}{\partial x}\).

When we give as an input one of these two types of differential equations, ChatGPT checks whether \(\tfrac{\partial M}{\partial y}=\tfrac{\partial N}{\partial x}\). Next, it determines the type of differential equation. At the end, it successfully solves the differential equation. ChatGPT does not have difficulty determining the correct integrating factor for solving the differential equation by the integratingfactor method.

Example 4. The differential equation \(4 x^{3} y^{2} d x+\left(y^{4}-x^{4} y+5\right) d y=\) 0 with an integrating factor \(\lambda=\lambda(y)\) has the general solution \(\tfrac{y^{2}}{2}+\tfrac{x^{4}}{y}-\)\(\tfrac{5}{2 y^{2}}=C\).

ChatGPT checks whether \(\tfrac{\partial M}{\partial y}=\tfrac{\partial N}{\partial x}\), Figure 4:

Figure 4. Check of \(\tfrac{\partial M}{\partial y}=\tfrac{\partial N}{\partial x}\) by ChatGPT

ChatGPT concludes that \(\tfrac{\partial M}{\partial y} \neq \tfrac{\partial N}{\partial x}\); therefore, the given equation requires an integrating factor. It determined the integrating factor \(\lambda=\lambda(y)=\tfrac{1}{y^{3}}\) and gave the general solution, Figure 5:

Figure 5. The integrating factor \(\lambda=\lambda(y)\)

2.4. Riccati, Clairaut and Lagrange differential equation

The Riccati differential equation has the form

(6) \[ y^{\prime}=P(x) y^{2}+Q(x) y+R(x) \]

where \(P(x), Q(x), R(x)\) are given functions. For \(P(x) \equiv 0\), the equation (6) is a first-order linear differential equation. For \(R(x) \equiv 0\), the equation (6) reduces to a Bernoulli differential equation. The equation (6) is not generally solved by quadrature, but if one particular solution is known, it can be transformed into a linear or Bernoulli differential equation using an appropriate substitution. ChatGPT successfully recognizes and solves Riccati differential equations.

The Clairaut differential equation has the form

\[ y=x y^{\prime}+\varphi\left(y^{\prime}\right), \] where \(\varphi\) is a differentiable function of \(y^{\prime}\). These equations have a singular solution besides the general solution.

Example 5. The Clairaut differential equation \(y=x y^{\prime}+\tfrac{1}{y^{\prime}}\) has the general solution \(y=C x+\tfrac{1}{C}, C \neq 0\), and the singular solution \(y^{2}=4 x\). Figure 6 shows ChatGPT’s solution:

Figure 6. ChatGPT’s solution for Clairaut’s differential equation

ChatGPT successfully recognizes both Clairaut and Riccati differential equations, but in certain cases ChatGPT makes mistakes in determining the singular solution of this type of equation.

The Lagrange differential equation has the form

\[ y=x \varphi\left(y^{\prime}\right)+\psi\left(y^{\prime}\right) \]

where \(\varphi, \psi\) are differentiable functions of \(y^{\prime}\). These equations are solved in the same way as Clairaut equations. Therefore, ChatGPT recognizes Lagrange differential equations, but it sometimes makes errors in determining the singular solution.

2.5. Other differential equations not solved for the derivative

In this part, we tried to solve some special cases of differential equations not solved for the derivative

(7) \[ F\left(x, y, y^{\prime}\right)=0 \]

When equation (7) can be solved for \(y^{\prime}\), one or more equations of the form \(y^{\prime}=f(x, y)\) are obtained. The resulting equations belong to one of the known classes, such as homogeneous, linear, etc.

Example 6. The differential equation \(x y^{\prime 2}-2 x y^{\prime}+y=0\) has the general solution \((y+C)^{2}=4 C x\) and the singular solution \(y=x\). Figure 7 shows ChatGPT’s solution:

Figure 7. ChatGPT’s solution of Example 6

The solution is incorrect, and ChatGPT does not identify the singular solution.

When the equation (7) has the form \(f\left(x, y^{\prime}\right)=0\) and \(x\) can be expressed as a function of \(y^{\prime}\), the solution is obtained in the parametric form.

Example 7. The differential equation \(y^{\prime}-\operatorname{arctg} y^{\prime}+\tfrac{x}{y^{\prime}}=0\) has the general solution in the parametric form

\[ \left\{\begin{array}{c} x=p \operatorname{arctg} p-p^{2} \\ y=\tfrac{1}{2}\left(p^{2}-1\right) \operatorname{arctg} p+\tfrac{p}{2}-\tfrac{2}{3} p^{3}+C \end{array} .\right. \] where \(p=y^{\prime}\). Figure 8 shows ChatGPT's incorrect solution.

Figure 8. ChatGPT’s solution for the differential equation \(f\left(x, y^{\prime}\right)=0\)

When the equation (7) has the form \(f\left(y, y^{\prime}\right)=0\), , the solution is obtained in the parametric form. Two cases are possible: if \(y\) can be expressed as a function of \(y^{\prime}\) or if \(y\) cannot be, but \(y\) and \(y^{\prime}\) can be expressed via some parameter \(t\).

Example 8. The differential equation \(y^{\tfrac{2}{5}}+y^{\tfrac{2}{5}}=a^{\tfrac{2}{5}}\) has the form \(f\left(y, y^{\prime}\right)=0\) where \(y=a \sin ^{5} t\) and \(y^{\prime}=a \cos ^{5} t\) are expressed in terms of the parameter \(t\). It has the general solution in the parametric form:

\[ \left\{\begin{array}{c} x=5\left(\tfrac{1}{3} \operatorname{tg}^{3} t-\operatorname{tg} t+t\right)+C \\ y=a \sin ^{5} t \end{array} .\right. \]

Figure 9 shows an incorrect ChatGPT solution.

Figure 9. ChatGPT’s solution for the differential equation \(f\left(y, y^{\prime}\right)=0\)

ChatGPT does not even consider introducing a new parameter to solve the equation and instead attempts to obtain a numerical solution, which is not our goal. Thus, ChatGPT has difficulties with differential equations that are not solved for the derivative.

3. Conclusions

In our research, we tested ChatGPT on 200 different differential equations, 20 from each of the 10 previously mentioned types. In Table 1 we can see for how many of them ChatGPT produced a correct analytical solution and for how many of them it made a mistake in the solution it evaluated.

We must point out that all incorrect solutions occurred when the input consisted of differential equations whose type could not be recognized without prior transformations. When the differential equation was presented in its standard form, ChatGPT produced \(100 \%\) accurate answers. We must also point out that except for the last type, although there were few examples with an error in the analytical solution, the solution was very close to the correct one.

Table 1. Correct and incorrect ChatGPT’s solutions

Type of differentialequationCorrectsolutionIncorrectsolutionSeparable variables146Homogeneous173Linear155Bernoulli155Exact differential equation191Withintegrating factor173Riccati182Clairaut182Lagrange??????? ? ?????? Not reduced by thederivative416

Thus, we can conclude that ChatGPT performs excellently on first-order differential equations, except those that are not reduced to the derivative, and it produces accurate analytical solutions.

The main conclusions of our research are as follows:

1. ChatGPT solves the problems in detail.

2. ChatGPT writes down all the formulas it uses.

3. Each step is explained in detail.

4. ChatGPT easily obtains a particular solution from an already obtained general solution of a differential equation.

5. ChatGPT easily finds a general solution for separable differential equations which don’t need too many transformations for recognizing the equation type.

6. If the linear and Bernoulli differential equations are presented in the form of a direct application of the solution scheme, ChatGPT recognizes them and has no difficulty finding a general solution.

However, suppose it needs to transform the differential equation into a linear or Bernoulli one. In that case, ChatGPT sometimes has a problem recognizing the type of such a differential equation. In these rare cases, the resulting solution is incorrect.

7. ChatGPT has difficulty obtaining a solution for more complex nonlinear differential equations.

8. ChatGPT almost always finds only a general solution to the differential equation, which it considers to be its ultimate solution.

For differential equations that have singular solutions, it does not identify them, and thus does not even treat them as solutions to a differential equation.

9. ChatGPT can serve as an excellent assistant for dealing with first-order differential equations.

REFERENCES

Alafnan, A.M., Dishari, S., Jovic, M., Lomidze, K. (2023). ChatGPT as an educational tool: opportunities, challenges and recommendations for communication, business writing, and composition courses. Journal of Artificial Intelligence and Technology, 3(2), 60 – 68.

Albadarin, Y., Saqr, M., Pope, N., Tukiainen, M. (2024). A systematic literature review of empirical research on ChatGPT in education. Discover Education, 3(1).

Ausat, A.M. A., Massang, B., Efendi, M., Nofirman, N., Riady, Y. (2023). Can ChatGPT replace the role of the teacher in the classroom: a fundamental analysis. Journal of Education, 5(4), 16100-16106.

Castro, C. (2023). A Discussion about the Impact of ChatGPT in Education: Benefits and Concerns. Journal of Business Theory and Practices, 11(2), 28 – 34.

Celakoski, N. (1986). Differential equations with examples and tasks (second edition). Skopje: SS. Cyril and Methodius University in Skopje [In Macedonian].

Celakoski, N. (1988). Examples and tasks of differential equations (second edition). Skopje: SS. Cyril and Methodius University in Skopje [In Macedonian].

Firaina, R., Sulisworo, D. (2023). Exploring the usage of ChatGPT in higher education: frequency and impact of productivity. Buletin Educasi Indonesia, 2(1), 39 – 46.

Frieder, S., Pinchetti, L., Chevalier, A., Griffiths, R.R., Salvatori, T., Lukasiewicz, T., Christian, P.C., Berner, J. (2023). Mathematical Capabilities of ChatGPT. arXiv:2301.13867.

Koceska, N., Koceski, S., Lazarova, K,L., Miteva, M., Zlatanovska, B. (2023). Can ChatGPT be used for solving ordinary differential equations. Balkan Journal of Applied Mathematics and Informatics, 6(2), 103 – 114.

Koceska, N., Koceski, S., Lazarova, K.L., Miteva, M., Zlatanovska, B. (2025). Exploring the performance of ChatGPT for numerical solution of ordinary differential equations. Journal of Technology and Science Education, 15(1), 18 – 34.

Zlatanovska, B., Miteva, M., Kocaleva, M. (2024). Using ChatGPT in solving definite integrals. In: Proceedings of the XIII International conference on social and technological development, 340 – 348.

Plevris, V., Papazafeiropoulos, G., Rios, A.J. (2023). Chatbots put to the test in math and logic problems: A preliminary comparison and assessment of ChatGPT-3.5, ChatGPT-4, and Google Bard. ArXiv.

Rane, N. (2023). Enhancing Mathematical Capabilities through ChatGPT and Similar Generative Artificial Intelligence: Roles and Challenges in Solving Mathematical Problems. Available at SSRN: https://ssrn.com/abstract=4603237 or http://dx. doi.org/10.2139/ssrn.4603237

Year LXIX, 2026/4 Archive

pp. 473 - 490 Download PDF