2.1.6 Problem 1 (vi)

2.1.6.1 Existence and uniqueness analysis
2.1.6.2 Solved using first_order_ode_quadrature
2.1.6.3 Solved using first_order_ode_exact
2.1.6.4 Maple
2.1.6.5 Mathematica
2.1.6.6 Sympy

Internal problem ID [19664]
Book : Elementary Differential Equations. By R.L.E. Schwarzenberger. Chapman and Hall. London. First Edition (1969)
Section : Chapter 3. Solutions of first-order equations. Exercises at page 47
Problem number : 1 (vi)
Date solved : Thursday, December 11, 2025 at 01:40:39 PM
CAS classification : [_quadrature]

2.1.6.1 Existence and uniqueness analysis
\begin{align*} x^{\prime }&=\frac {\cos \left (t \right )}{\sin \left (t \right )} \\ x \left (1\right ) &= 0 \\ \end{align*}
This is a linear ODE. In canonical form it is written as
\begin{align*} x^{\prime } + q(t)x &= p(t) \end{align*}

Where here

\begin{align*} q(t) &=0\\ p(t) &=\cot \left (t \right ) \end{align*}

Hence the ode is

\begin{align*} x^{\prime } = \cot \left (t \right ) \end{align*}

The domain of \(q(t)=0\) is

\[ \{-\infty <t <\infty \} \]
And the point \(t_0 = 1\) is inside this domain. The domain of \(p(t)=\cot \left (t \right )\) is
\[ \{t <\pi \_Z716 \boldsymbol {\lor }\pi \_Z716 <t\} \]
And the point \(t_0 = 1\) is also inside this domain. Hence solution exists and is unique.
2.1.6.2 Solved using first_order_ode_quadrature

0.068 (sec)

Entering first order ode quadrature solver

\begin{align*} x^{\prime }&=\frac {\cos \left (t \right )}{\sin \left (t \right )} \\ x \left (1\right ) &= 0 \\ \end{align*}
Since the ode has the form \(x^{\prime }=f(t)\), then we only need to integrate \(f(t)\).
\begin{align*} \int {dx} &= \int {\frac {\cos \left (t \right )}{\sin \left (t \right )}\, dt}\\ x &= \ln \left (\sin \left (t \right )\right ) + c_1 \end{align*}

Solving for initial conditions the solution is

\begin{align*} x &= \ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \\ \end{align*}
Solution plot Slope field \(x^{\prime } = \frac {\cos \left (t \right )}{\sin \left (t \right )}\)

Summary of solutions found

\begin{align*} x &= \ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \\ \end{align*}
2.1.6.3 Solved using first_order_ode_exact

0.074 (sec)

Entering first order ode exact solver

\begin{align*} x^{\prime }&=\frac {\cos \left (t \right )}{\sin \left (t \right )} \\ x \left (1\right ) &= 0 \\ \end{align*}

To solve an ode of the form

\begin{equation} M\left ( x,y\right ) +N\left ( x,y\right ) \frac {dy}{dx}=0\tag {A}\end{equation}
We assume there exists a function \(\phi \left ( x,y\right ) =c\) where \(c\) is constant, that satisfies the ode. Taking derivative of \(\phi \) w.r.t. \(x\) gives
\[ \frac {d}{dx}\phi \left ( x,y\right ) =0 \]
Hence
\begin{equation} \frac {\partial \phi }{\partial x}+\frac {\partial \phi }{\partial y}\frac {dy}{dx}=0\tag {B}\end{equation}
Comparing (A,B) shows that
\begin{align*} \frac {\partial \phi }{\partial x} & =M\\ \frac {\partial \phi }{\partial y} & =N \end{align*}

But since \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) then for the above to be valid, we require that

\[ \frac {\partial M}{\partial y}=\frac {\partial N}{\partial x}\]
If the above condition is satisfied, then the original ode is called exact. We still need to determine \(\phi \left ( x,y\right ) \) but at least we know now that we can do that since the condition \(\frac {\partial ^{2}\phi }{\partial x\partial y}=\frac {\partial ^{2}\phi }{\partial y\partial x}\) is satisfied. If this condition is not satisfied then this method will not work and we have to now look for an integrating factor to force this condition, which might or might not exist. The first step is to write the ODE in standard form to check for exactness, which is
\[ M(t,x) \mathop {\mathrm {d}t}+ N(t,x) \mathop {\mathrm {d}x}=0 \tag {1A} \]
Therefore
\begin{align*} \mathop {\mathrm {d}x} &= \left (\frac {\cos \left (t \right )}{\sin \left (t \right )}\right )\mathop {\mathrm {d}t}\\ \left (-\frac {\cos \left (t \right )}{\sin \left (t \right )}\right ) \mathop {\mathrm {d}t} + \mathop {\mathrm {d}x} &= 0 \tag {2A} \end{align*}

Comparing (1A) and (2A) shows that

\begin{align*} M(t,x) &= -\frac {\cos \left (t \right )}{\sin \left (t \right )}\\ N(t,x) &= 1 \end{align*}

The next step is to determine if the ODE is is exact or not. The ODE is exact when the following condition is satisfied

\[ \frac {\partial M}{\partial x} = \frac {\partial N}{\partial t} \]
Using result found above gives
\begin{align*} \frac {\partial M}{\partial x} &= \frac {\partial }{\partial x} \left (-\frac {\cos \left (t \right )}{\sin \left (t \right )}\right )\\ &= 0 \end{align*}

And

\begin{align*} \frac {\partial N}{\partial t} &= \frac {\partial }{\partial t} \left (1\right )\\ &= 0 \end{align*}

Since \(\frac {\partial M}{\partial x}= \frac {\partial N}{\partial t}\), then the ODE is exact The following equations are now set up to solve for the function \(\phi \left (t,x\right )\)

\begin{align*} \frac {\partial \phi }{\partial t } &= M\tag {1} \\ \frac {\partial \phi }{\partial x } &= N\tag {2} \end{align*}

Integrating (1) w.r.t. \(t\) gives

\begin{align*} \int \frac {\partial \phi }{\partial t} \mathop {\mathrm {d}t} &= \int M\mathop {\mathrm {d}t} \\ \int \frac {\partial \phi }{\partial t} \mathop {\mathrm {d}t} &= \int -\frac {\cos \left (t \right )}{\sin \left (t \right )}\mathop {\mathrm {d}t} \\ \tag{3} \phi &= -\ln \left (\sin \left (t \right )\right )+ f(x) \\ \end{align*}
Where \(f(x)\) is used for the constant of integration since \(\phi \) is a function of both \(t\) and \(x\). Taking derivative of equation (3) w.r.t \(x\) gives
\begin{equation} \tag{4} \frac {\partial \phi }{\partial x} = 0+f'(x) \end{equation}
But equation (2) says that \(\frac {\partial \phi }{\partial x} = 1\). Therefore equation (4) becomes
\begin{equation} \tag{5} 1 = 0+f'(x) \end{equation}
Solving equation (5) for \( f'(x)\) gives
\[ f'(x) = 1 \]
Integrating the above w.r.t \(x\) gives
\begin{align*} \int f'(x) \mathop {\mathrm {d}x} &= \int \left ( 1\right ) \mathop {\mathrm {d}x} \\ f(x) &= x+ c_1 \\ \end{align*}
Where \(c_1\) is constant of integration. Substituting result found above for \(f(x)\) into equation (3) gives \(\phi \)
\[ \phi = -\ln \left (\sin \left (t \right )\right )+x+ c_1 \]
But since \(\phi \) itself is a constant function, then let \(\phi =c_2\) where \(c_2\) is new constant and combining \(c_1\) and \(c_2\) constants into the constant \(c_1\) gives the solution as
\[ c_1 = -\ln \left (\sin \left (t \right )\right )+x \]
Solving for initial conditions the solution is
\begin{align*} -\ln \left (\sin \left (t \right )\right )+x &= -\ln \left (\sin \left (1\right )\right ) \\ \end{align*}
Solving for \(x\) gives
\begin{align*} x &= \ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \\ \end{align*}
Solution plot Slope field \(x^{\prime } = \frac {\cos \left (t \right )}{\sin \left (t \right )}\)

Summary of solutions found

\begin{align*} x &= \ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \\ \end{align*}
2.1.6.4 Maple. Time used: 0.031 (sec). Leaf size: 13
ode:=diff(x(t),t) = cos(t)/sin(t); 
ic:=[x(1) = 0]; 
dsolve([ode,op(ic)],x(t), singsol=all);
 
\[ x = \ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \]

Maple trace

Methods for first order ODEs: 
--- Trying classification methods --- 
trying a quadrature 
<- quadrature successful
 

Maple step by step

\[ \begin {array}{lll} & {} & \textrm {Let's solve}\hspace {3pt} \\ {} & {} & \left [\frac {d}{d t}x \left (t \right )=\frac {\cos \left (t \right )}{\sin \left (t \right )}, x \left (1\right )=0\right ] \\ \bullet & {} & \textrm {Highest derivative means the order of the ODE is}\hspace {3pt} 1 \\ {} & {} & \frac {d}{d t}x \left (t \right ) \\ \bullet & {} & \textrm {Integrate both sides with respect to}\hspace {3pt} t \\ {} & {} & \int \left (\frac {d}{d t}x \left (t \right )\right )d t =\int \frac {\cos \left (t \right )}{\sin \left (t \right )}d t +\mathit {C1} \\ \bullet & {} & \textrm {Evaluate integral}\hspace {3pt} \\ {} & {} & x \left (t \right )=\ln \left (\sin \left (t \right )\right )+\mathit {C1} \\ \bullet & {} & \textrm {Use initial condition}\hspace {3pt} x \left (1\right )=0 \\ {} & {} & 0=\ln \left (\sin \left (1\right )\right )+\mathit {C1} \\ \bullet & {} & \textrm {Solve for}\hspace {3pt} \textit {\_C1} \\ {} & {} & \mathit {C1} =-\ln \left (\sin \left (1\right )\right ) \\ \bullet & {} & \textrm {Substitute}\hspace {3pt} \textit {\_C1} =-\ln \left (\sin \left (1\right )\right )\hspace {3pt}\textrm {into general solution and simplify}\hspace {3pt} \\ {} & {} & x \left (t \right )=\ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \\ \bullet & {} & \textrm {Solution to the IVP}\hspace {3pt} \\ {} & {} & x \left (t \right )=\ln \left (\sin \left (t \right )\right )-\ln \left (\sin \left (1\right )\right ) \end {array} \]
2.1.6.5 Mathematica. Time used: 0.006 (sec). Leaf size: 11
ode=D[x[t],t]==Cos[t]/Sin[t]; 
ic={x[1]==0}; 
DSolve[{ode,ic},x[t],t,IncludeSingularSolutions->True]
 
\begin{align*} x(t)&\to \log (\csc (1) \sin (t)) \end{align*}
2.1.6.6 Sympy. Time used: 0.088 (sec). Leaf size: 12
from sympy import * 
t = symbols("t") 
x = Function("x") 
ode = Eq(Derivative(x(t), t) - cos(t)/sin(t),0) 
ics = {x(1): 0} 
dsolve(ode,func=x(t),ics=ics)
                                                                                  
                                                                                  
 
\[ x{\left (t \right )} = \log {\left (\sin {\left (t \right )} \right )} - \log {\left (\sin {\left (1 \right )} \right )} \]