Solución de ecuaciones diferenciales de primer orden
Variables separables
Considere la ecuacion diferencial de primer orden
(10)\[
\frac{\mathrm{d}y}{\mathrm{d}x} = g(x).
\]
Si \(g(x)\) es una función continua, podemos resolver (10) por medio de integración. Es decir, integrando ambos lados de la ecuación obtenemos
\[
y = \int g(x)~ \mathrm{d}x = G(x) + c,
\]
donde \(G(x)\) es la integral indefinida de \(g(x)\).
Definition 4
Una EDO de primer orden de la forma
(11)\[
\frac{\mathrm{d}y}{\mathrm{d}x} = g(x)h(y),
\]
se dice que es separable o tiene variables separables.
La ecuación
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = y^{2}xe^{3x + 4y}
\]
es un tipo de ecuación separable porque podemos factorizar \(f(x,y)\) como sigue
\[
f(x,y) = y^{2}xe^{3x + 4y} = \underbrace{\left( xe^{3x} \right)}_{g(x)} \underbrace{\left(y^{2}e^{4y} \right)}_{h(y)}.
\]
Reescribiendo (11) de la siguiente forma
(12)\[
p(y)\frac{\mathrm{d}y}{\mathrm{d}x} = g(x),
\]
con \(p(y) := 1/h(y)\).
Si decimos que \(y=\phi(x)\) es la solución de la Ec. (12), tenemos
\[
p\left(\phi\left(x\right) \right)\phi'\left(x\right) = g(x).
\]
Integrando por ambos lados de la igualdad
\[
\int p\left(\phi\left(x\right) \right)\phi'\left(x\right)~\mathrm{d}x = \int g(x)~\mathrm{d}x.
\]
Como \(\mathrm{d}y = \phi'(x)\mathrm{d}x\), tenemos
\[
\int p(y)~\mathrm{d}y = \int g(x)~\mathrm{d}x,
\]
o bien
\[
H(y) = G(x) + c.
\]
Ejemplo
Resuelva la siguiente ecuación diferencial utilizando el método de variable separada
(13)\[
(1 + x)~\mathrm{d}y - y~\mathrm{d}x = 0.
\]
Diviendo la Ec. (13) por \((1 + x)y\), tenemos
\[\begin{split}
\begin{aligned}
\int \frac{\mathrm{d}y}{y} &= \int \frac{\mathrm{d}x}{1 + x}, \\
\ln{(y)} &= \ln{(1 + x)} + c_{1}.
\end{aligned}
\end{split}\]
Aplicando la ley de los exponentes en ambos lados de la igualdad
\[\begin{split}
\begin{aligned}
y &= e^{\ln{(1 + x)} + c_{1}}, \\
&= e^{\ln{(1 + x)}}\cdot e^{c_{1}}, \\
&= |1 + x|e^{c_{1}}, \\
&= \pm e^{c_{1}} \left(1 + x \right), \\
&= c \left(1 + x \right),
\end{aligned}
\end{split}\]
donde \(c:=\pm e^{c_{1}}\).
Ejemplo
Resuelva el siguiente problema de valor inicial
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = -\frac{x}{y}, \quad y(4) = -3.
\]
Multiplicando términos de forma cruzada, tenemos
\[
y~\mathrm{d}y = -x~\mathrm{d}x.
\]
Integrando ambos lados de la igualdad
(14)\[\begin{split}
\begin{aligned}
\int y~\mathrm{d}y &= -\int x~\mathrm{d}x, \\
\frac{y^{2}}{2} &= -\frac{x^{2}}{2} + c_{1}, \\
x^{2} + y^{2} &= c^{2},
\end{aligned}
\end{split}\]
donde \(c^{2}:=2c_{1}\).
Considerando la condición inicial \(y(4) = -3\), se tiene
\[\begin{split}
\begin{aligned}
c^{2} &= (4)^{2} + (-3)^{2}, \\
&= 16 + 9, \\
&= 25.
\end{aligned}
\end{split}\]
Sustituyendo \(c^{2}\) en (14)
\[
x^{2} + y^{2} = 25.
\]
Ejemplo
Resuelva la siguiente ecuación diferencial
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = y^{2} - 4.
\]
Cruzando términos, tenemos
\[\begin{split}
\begin{aligned}
\frac{\mathrm{d}y}{y^{2} - 4} &= \mathrm{d}x, \\
\frac{1}{\left(y - 2\right)} \frac{1}{\left(y + 2\right)}~\mathrm{d}y &= \mathrm{d}x.
\end{aligned}
\end{split}\]
Utilizando fracciones parciales, podemos experesar la ecuación anterior como sigue
\[
\left[ \frac{k_{1}}{\left(y - 2\right)} + \frac{k_{2}}{\left(y + 2\right)}\right]~\mathrm{d}y = \mathrm{d}x.
\]
Entonces
\[
k_{1} = \left.\frac{1}{\left(y - 2\right)} \frac{1}{\left(y + 2\right)}\left(y - 2\right)\right|_{y = 2} = \frac{1}{4},
\]
\[
k_{2} = \left.\frac{1}{\left(y - 2\right)} \frac{1}{\left(y + 2\right)}\left(y + 2\right)\right|_{y = -2} = -\frac{1}{4}.
\]
Sustituyendo \(k_{1}\) y \(k_{2}\)
\[
\left[ \frac{\frac{1}{4}}{\left(y - 2\right)} - \frac{\frac{1}{4}}{\left(y + 2\right)}\right]~\mathrm{d}y = \mathrm{d}x.
\]
Integrando ambos lados de la igualdad y utilizando las leyes de los logaritmos
\[\begin{split}
\begin{aligned}
\frac{1}{4}\ln{\left( y - 2 \right)} - \frac{1}{4}\ln{\left( y + 2 \right)} &= x + c_{1}, \\
\ln{\left( \frac{y - 2}{y + 2} \right)} &= 4x + c_{2}, \\
\frac{y - 2}{y + 2} &= \pm e^{4x + c_{2}},
\end{aligned}
\end{split}\]
donde \(c_{2}:=4c_{1}\). Despejando \(y\), tenemos una familia uniparamétrica de soluciones de la forma
\[
y = 2 \frac{1 + ce^{4x}}{1 - ce^{4x}},
\]
donde \(c:=\pm e^{c_{2}}\).
Ejemplo
Resulta la siguiente ecuación diferencial
\[
\left( e^{2y} - y \right) \cos{(x)}~ \frac{\mathrm{d}y}{\mathrm{d}x} = e^{y}\sin{(2x)}, \quad y(0) = 0.
\]
Dividiendo la ecuación por \(e^{y} \cos{(x)}\), tenemos
\[
\frac{e^{2y} - y}{e^{y}}~\mathrm{d}y = \frac{\sin{(2x)}}{\cos{(x)}}~\mathrm{d}x.
\]
Recordando la identidad trigonométrica \(\sin{(2x)} = 2\sin{(x)}\cos{(x)}\) e integrando ambos lados de la igualdad, tenemos
\[\begin{split}
\begin{aligned}
\left(e^{y} - ye^{-y} \right) &= 2 \sin{(x)}, \\
\int \left(e^{y} - ye^{-y} \right)~\mathrm{d}y &= 2 \int \sin{(x)} ~\mathrm{d}x, \\
\int e^{y}~\mathrm{d}y - \int ye^{-y}~\mathrm{d}y &= 2 \int \sin{(x)} ~\mathrm{d}x, \\
e^{y} - \int ye^{-y}~\mathrm{d}y &= -2 \cos{(x)} + c.
\end{aligned}
\end{split}\]
Integrando por partes, podemos utilizar el mnemónico ILATE para definir \(u\)
Entonces
\[
u = y \quad \rightarrow \quad \mathrm{d}u = \mathrm{d}y,
\]
\[
\mathrm{d}v = e^{-y}\quad \rightarrow \quad \int \mathrm{d}v = \int e^{-y}~\mathrm{d}y\quad \rightarrow \quad v = -e^{-y}.
\]
\[
-ye^{-y} + \int e^{-y}~\mathrm{d}y \quad \rightarrow \quad -ye^{-y} - e^{-y}.
\]
Sustituyendo el resultado de la integración por partes
\[\begin{split}
\begin{aligned}
e^{y} - \left( -ye^{-y} - e^{-y} \right) &= -2 \cos{(x)} + c, \\
e^{y} + ye^{-y} + e^{-y} &= -2 \cos{(x)} + c.
\end{aligned}
\end{split}\]
Tomando en cuenta la condición inicial \(y(0) = 0\), tenemos
\[\begin{split}
\begin{aligned}
e^{0} + (0)e^{0} + e^{0} &= -2 \cos{(0)} + c, \\
2 &= -2 + c, \\
4 &= c.
\end{aligned}
\end{split}\]
Por lo tanto, la solución queda expresada como sigue
\[
e^{y} + ye^{-y} + e^{-y} = 4 - 2 \cos{(x)}.
\]
Ecuaciones lineales
Definition 5
Una ED de primer orden de la forma
(15)\[
a_{1}(x) \frac{\mathrm{d}y}{\mathrm{d}x} + a_{0}(x)y = g(x),
\]
se dice que es una ecuación lineal en la variable dependiente \(y\).
Nota
Si \(g(x) = 0\), entonces la Ec. (15) es homogénea de lo contrario es no homogénea.
La forma estándar de una ecuación lineal se obtiene al dividir ambos lados de la Ec. (15) por el coeficiente \(a_{1}(x)\)
(16)\[
\frac{\mathrm{d}y}{\mathrm{d}x} + P(x)y = f(x).
\]
La solución \(y\) de la Ec. (16) es la suma de la solución de la ecuación homogénea asociada \(y_{c}\) y la solución particular de la ecuación no homogénea \(y_{p}\). Esto es
\[
\frac{\mathrm{d}}{\mathrm{d}x} \left[ y_{c} + y_{p} \right] + P(x) \left[ y_{c} + y_{p} \right] = \underbrace{\left[ \frac{\mathrm{d}y_{c}}{\mathrm{d}x} + P(x)y_{c} \right]}_{0} + \underbrace{\left[ \frac{\mathrm{d}y_{p}}{\mathrm{d}x} + P(x)y_{p} \right]}_{f(x)} = f(x)
\]
Reescribiendo la ecuación, tenemos
\[
\frac{\mathrm{d}y}{y} + P(x)~\mathrm{d}x = 0.
\]
Para resolver la Ec. (16), utilizamos la técnica de variación de parámetros. Donde es necesario encontrar una función \(u\) tal que
\[\begin{split}
\begin{aligned}
y_{p} &= u(x)y_{1}(x), \\
&= u(x)e^{-\int P(x) \mathrm{d}x}.
\end{aligned}
\end{split}\]
sea la solución.
Sustituyendo \(y_{p}\) y \(c\) por el parámetro variable \(u\), se obtiene
\[
\underbrace{u\frac{\mathrm{d}y_{1}}{\mathrm{d}x} + y_{1} \frac{\mathrm{d}u}{\mathrm{d}x} }_{\text{regla del producto}} + P(x) u y_{1} = f(x),
\]
\[
u \underbrace{\left[ \frac{\mathrm{d}y_{1}}{\mathrm{d}x} + P(x)y_{1} \right]}_{\text{cero}} + y_{1}~\frac{\mathrm{d}u}{\mathrm{d}x} = f(x).
\]
Por lo tanto
\[
y_{1}~\frac{\mathrm{d}u}{\mathrm{d}x} = f(x).
\]
Aplicando el método de separación de variables e integrando ambos lados de la igualdad, se tiene
\[\begin{split}
\begin{aligned}
\mathrm{d}u &= \frac{f(x)}{y_{1}(x)}~\mathrm{d}x, \\
u &= \int \frac{f(x)}{y_{1}(x)}~\mathrm{d}x.
\end{aligned}
\end{split}\]
Puesto que \(y_{1}(x) = e^{-\int P(x)~\mathrm{d}x}\), tenemos
\[\begin{split}
\begin{aligned}
y_{p} &= uy_{1}, \\
&= \left( \int \frac{f(x)}{y_{1}(x)}~\mathrm{d}x \right)e^{-\int P(x)~\mathrm{d}x}, \\
&= e^{-\int P(x)~\mathrm{d}x} ~ \int e^{\int P(x)~\mathrm{d}x} f(x) \mathrm{d}x,
\end{aligned}
\end{split}\]
y por lo tanto
(17)\[
y = \underbrace{ce^{-\int P(x)~\mathrm{d}x}}_{y_{c}} + \underbrace{ e^{-\int P(x)~\mathrm{d}x} ~ \int e^{\int P(x)~\mathrm{d}x} f(x) \mathrm{d}x}_{y_{p}}
\]
Multiplicando la Ec. (17) por el término \(e^{\int P(x)~\mathrm{d}x}\), se obtiene
\[
e^{\int P(x)~\mathrm{d}x}~y = c + \int e^{\int P(x)~\mathrm{d}x}~f(x)~\mathrm{d}x.
\]
Si derivamos la ecuación anterior
\[\begin{split}
\begin{aligned}
\frac{\mathrm{d}}{\mathrm{d}x}\left[ e^{\int P(x)~\mathrm{d}x}~y \right] &= e^{\int P(x)~\mathrm{d}x}~f(x), \\
e^{\int P(x)~\mathrm{d}x}\frac{\mathrm{d}y}{\mathrm{d}x} + P(x)~e^{\int P(x)~\mathrm{d}x}y &= e^{\int P(x)~\mathrm{d}x}~f(x).
\end{aligned}
\end{split}\]
Importante
El término \(e^{\int P(x)~\mathrm{d}x}\) se llama factor integrante.
Ejemplo
Resuelva la siguiente ED lineal homogénea
\[
\frac{\mathrm{d}y}{\mathrm{d}x} - 3y = 0.
\]
De lo anterior, tenemos \(P(x) = -3\) y por lo tanto el factor integrante es
\[
e^{\int (-3)~\mathrm{d}x} = e^{-3x}.
\]
Si multiplicamos este factor por la ecuación diferencial, tenemos
\[
e^{-3x}~\frac{\mathrm{d}y}{\mathrm{d}x} - 3e^{-3x}~y = 0,
\]
cuya solución es
\[
y = ce^{3x},\quad x\in(-\infty, \infty).
\]
Ejemplo
Resuelva la siguiente ED lineal no homogénea
\[
\frac{\mathrm{d}y}{\mathrm{d}x} - 3y = 6,
\]
La ecuación sigue en la forma estándar y el factor integrante es \(e^{-3x}\). Multiplicando por ambos lados, tenemos
\[
e^{-3x}~\frac{\mathrm{d}y}{\mathrm{d}x} - 3e^{-3x}~y = 6e^{-3x},
\]
por lo tanto la solución está dada por
\[
y = -2 + ce^{3x},\quad x\in(-\infty,\infty).
\]
Ecuaciones exactas
Definition 6
Una expresión diferencial \(M(x,y)~\mathrm{d}x + N(x,y)~\mathrm{d}y\) es una diferencial exacta en una región \(R\) del plano \(xy\) si corresponde a la diferencial de una función \(f(x,y) \in R\). Una ED de primer orden de la forma
\[
M(x,y)~\mathrm{d}x + N(x,y)~\mathrm{d}y = 0,
\]
se dice que es una ecuación exacta si la expresión del lado izquierdo es una diferencial exacta.
Considere la siguiente ED
\[
x^{2}y^{3}~\mathrm{d}x + x^{3}y^{2}~\mathrm{d}y = 0.
\]
Identificando que
\[
M(x,y) = x^{2}y^{3}, \quad N(x,y) = x^{3}y^{2},
\]
tenemos que
\[
\frac{\partial M}{\partial y} = 3x^{2}y^{2} = \frac{\partial N}{\partial x}.
\]
Lo anterior se puede comprobar con el siguiente teorema
Theorem 1 (Criterio para una diferencial exacta)
Sean \(M(x,y)\) y \(N(x,y)\) continuas, donde sus primeras derivadas parciales son continuas en una región rectangular \(R\) definida por \(a<x<b\), \(c<y<d\). Entonces una condición necesaria y suficiente para que \(M(x,y)\mathrm{d}x + N(x,y)\mathrm{d}y\) sea una diferencial exacta es
\[
\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}.
\]
Ejemplo
Resuelva la siguiente ED exacta
\[
2xy~\mathrm{d}x + \left(x^{2} - 1 \right)~\mathrm{d}y = 0
\]
De lo anterior tenemos
\[
M(x,y) = 2xy, \quad N(x,y) = x^{2} - 1
\]
y por lo tanto
\[
\frac{\partial M}{\partial y} = 2x = \frac{\partial N}{\partial x}.
\]
Por el Theorem 1 existe una función \(f(x,y)\) tal que
\[
\frac{\partial f}{\partial x} = 2xy, \quad \frac{\partial f}{\partial y} = x^{2} - 1.
\]
Integrando la primera ecuación, se obtiene
\[
f(x,y) = x^{2}y + g(y).
\]
Derivamos parcialmente con respecto a \(y\) e igualando con \(N(x,y)\), obtenemos
\[
\frac{\partial f}{\partial y} = x^{2} + g'(y) = x^{2} - 1.
\]
Dado que \(g'(y) = -1\), \(g(y) = -y\) y \(f(x,y) = x^{2}y - y\), la solución de la ecuación en forma implicita es \(x^{2}y - y = c\). Además, la forma explícita de la solución está dada como \(y = c/\left(1 - x^{2}\right)\).
Ejemplo
Resuelva el siguiente PVI
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = \frac{xy^{2} - \cos(x)\sin(x)}{y\left( 1 - x^{2} \right)}, \quad y(0) = 2,
\]
Podemos corroborar que la ecuación es exacta debido a que
\[
\frac{\partial M}{\partial y} = -2xy = \frac{\partial N}{\partial x},
\]
\[
\frac{\partial f}{\partial y} = y\left( 1 - x^{2} \right),
\]
\[
f(x,y) = \frac{y^{2}}{2} \left( 1 - x^{2} \right) + h(x),
\]
\[
\frac{\partial f}{\partial x} = -xy^{2} + h'(x) = \cos(x)\sin(x) - xy^{2}.
\]
De lo anterior tenemos que \(h'(x) = \cos(x)\sin(x)\). Entonces, si integramos la ecuación anterior, tenemos
\[
h(X) = - \int (\cos(x))(-\sin(x)~\mathrm{d}x) = - \frac{1}{2}\cos^{2}(x).
\]
Por lo tanto, se obtiene
\[\begin{split}
\begin{aligned}
\frac{y^{2}}{2}\left( 1 - x^{2} \right) - \frac{1}{2} \cos^{2}(x) &= c_{1}, \\
y^{2}\left( 1 - x^{2} \right) - \cos^{2}(x) = c.
\end{aligned}
\end{split}\]
Tomando la condición inicial \(y(0)=2\)
\[\begin{split}
\begin{aligned}
(2)^{2}\left( 1 - (0)^{2} \right) - \cos^{2}(0) &= 0, \\
4(1) - \cos^{2}(0) &= c, \\
3 &= c.
\end{aligned}
\end{split}\]
Finalmente, la solución implícita del problema es
\[
y^{2}\left( 1 - x^{2} \right) - \cos^{2}(x) = 3.
\]
Soluciones por sustitución
Consiste en transformar una ED en otra ED para resolverla. Por ejemplo, considere la siguiente ecuación
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = f(x,y),
\]
sustituyendo \(y=g(x,u)\) donde \(u\) es una función de la variable \(x\), entonces, podemos aplicar la regla de la cadena como sigue
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = \frac{\partial g}{\partial x}\frac{\mathrm{d}x}{\mathrm{d}x} + \frac{\partial g}{\partial u}\frac{\mathrm{d}u}{\mathrm{d}x},
\]
o bien
\[
\frac{\mathrm{d}y}{\mathrm{d}x} = g_{x}(x,u) + g_{u}(x,u)\frac{\mathrm{d}u}{\mathrm{d}x}.
\]
Ecuaciones homogéneas
Si una función \(f\) tiene la siguiente propiedad
(18)\[
f(tx, ty) = t^{\alpha}f(x,y), \quad \alpha \in \mathbb{R},
\]
entonces la Ec. (18) se conoce como función homogénea de grado \(\alpha\).
La expresión
\[
f(x,y) = x^{3} + y^{3},
\]
es una función homogénea de grado 3 debido a lo siguiente
\[
f(tx,ty) = (tx)^{3} + (ty)^{3} = t^{3}x^{3} + t^{3}y^{3} = t^{3}\left(x^{3} + y^{3} \right) = t^{3}f(x,y).
\]
Una ED de primer orden de la forma diferencial
\[
M(x,y)~\mathrm{d}x + N(x,y)~\mathrm{d}y = 0,
\]
es homogénea si las funciones coeficientes \(M\) y \(N\) son funciones homogéneas del mismo grado. Es decir,
\[
M(tx,ty) = t^{\alpha}M(x,y), \qquad N(tx,ty) = t^{\alpha}N(x,y).
\]
Dado que \(M\) y \(N\) son funciones homogéneas de grado \(\alpha\), se pueden reescribir como sigue
\[
M(x,y) = x^{\alpha}M(1,u), \qquad N(x,y) = x^{\alpha}N(1,u), \quad u = \frac{y}{x},
\]
así como
\[
M(x,y) = y^{\alpha}M(v,1), \qquad N(x,y) = y^{\alpha}N(v,1), \quad v = \frac{x}{y}.
\]
Ejemplo
Resuelva la siguiente ED homogénea
(19)\[
\left(x^{2} + y^{2} \right)~\mathrm{d}x + \left(x^{2} - xy \right)~\mathrm{d}y = 0.
\]
De la Ec. (19) podemos observar que
\[
M(x,y) = x^{2} + y^{2}, \qquad N(x,y) = x^{2} - xy,
\]
donde se obtiene que el grado es 2.
Si hacemos \(y = ux\), entonces \(\mathrm{d}y = u~\mathrm{d}x + x~\mathrm{d}u\). Reescribiendo la ED, se tiene
\[\begin{split}
\begin{aligned}
\left(x^{2} + u^{2}x^{2} \right)~\mathrm{d}x + \left(x^{2} - ux^{2} \right) \left[u~\mathrm{d}x + x~\mathrm{d}u \right] &= 0, \\
x^{2}\left(1 + u\right)~\mathrm{d}x + x^{3}\left(1 - u\right)~\mathrm{d}u &= 0, \\
\frac{1 - u}{1 + u}~\mathrm{d}u + \frac{\mathrm{d}x}{x} &= 0, \\
\left[-1 + \frac{2}{1+u} \right]~\mathrm{d}u + \frac{\mathrm{d}x}{x} &=0.
\end{aligned}
\end{split}\]
Integrando ambos lados de la igualdad,
\[\begin{split}
\begin{aligned}
-u + 2\ln\left(1 + u \right) + \ln\left(x \right) &= \ln\left(c \right), \\
-\frac{y}{x} + 2\ln\left(1 + \frac{y}{x} \right) + \ln\left(x \right) &= \ln\left(c \right).
\end{aligned}
\end{split}\]
Si utilizamos las propiedades de los logaritmos, la expresión anterior queda definida como sigue
\[
\ln\left( \frac{\left(x + y\right)^{2}}{cx} \right) = \frac{y}{x}.
\]
Ecuación de Bernoulli
La ED
\[
\frac{\mathrm{d}y}{\mathrm{d}x} + P(x,y)y = f(x)y^{n},\quad n\in\mathbb{R},
\]
se llama ecuación de Bernoulli, donde es lineal para \(n=0\) y \(n=1\). Para el caso en que \(n\neq 0\), y \(n\neq 1\) la sustitución \(u = y^{1-n}\) reduce a la ecuación anterior a una ecuación lineal.
Ejemplo
Resuelva la siguiente ED de Bernoulli
\[
x~\frac{\mathrm{d}y}{\mathrm{d}x} + y = x^{2}y^{2}.
\]
Reescribiendo la ED anterior, obtenemos
(20)\[
\frac{\mathrm{d}y}{\mathrm{d}x} + \frac{1}{x} y = xy^{2}.
\]
De lo anterior observamos que \(n=2\) y por consiguiente, \(u=y^{1-n} = y^{-1}\) o bien \(y = u^{-1}\). Sustituyendo y aplicando la regla de la cadena tenemos
(21)\[
\frac{\mathrm{d}y}{\mathrm{d}x} = \frac{\mathrm{d}y}{\mathrm{d}u}\frac{\mathrm{d}u}{\mathrm{d}x} = -u^{-2}\frac{\mathrm{d}u}{\mathrm{d}x}.
\]
Sustituyendo (21) en (20)
(22)\[
\frac{\mathrm{d}u}{\mathrm{d}x} - \frac{1}{x}u = -x.
\]
De lo anterior, tenemos que \(P(x) = \frac{1}{x}\) y por consiguiente el factor integrante está definido como
\[
e^{-\int \frac{\mathrm{d}x}{x}} = e^{-\ln(x)} = e^{\ln\left(x^{-1}\right)} = x^{-1}.
\]
Multiplicando el factor integrante por ambos lados de la igualdad en la Ec. (22)
\[
\frac{\mathrm{d}}{\mathrm{d}x}\left[x^{-1}u \right] = -1.
\]
Integrando ambos lados se obtiene
\[
u = -x^{2} + cx,
\]
y dado que \(u = y^{-1} ~ \rightarrow ~ y = 1/u\), entonces la solución de la ED es
\[
y = \frac{1}{-x^{2} + cx}.
\]
Métodos numéricos
Método de Euler
Considere una Ecuación Diferencial Ordinaria (EDO) de la forma
(23)\[
\dot{y} = f(x),
\]
donde \(f\) es una función. La solución general a la Ec. (23) está dada por la siguiente expresión
\[
y = \int f(x)\mathrm{d}x + c,
\]
donde \(c\) es una constante arbitraria. Para obtener una solución, dependemos de un valor inicial de la forma
\[
y\left(x_{0}\right) = y_{0}.
\]
Para la mayoría de problemas de valor inicial no es posible encontrar una solución exacta (analítica) ya que las ecuaciones son no lineales, discontinuas, o estocásticas. Por ejemplo, \(\dot{y} = e^{{xy}^{4}}\). Por lo tanto, necesitamos de un método numérico para aproximar la solución.
Es posible aproximar el término del lado izquierdo de un problema de valor inicial \(\frac{\mathrm{d}f}{\mathrm{d}x}\) utilizando el teorema de Taylor alrededor de un punto dado \(x_{0}\)
\[
f\left(x_{1}\right) = f\left(x_{0}\right) + \left(x_{1}-x_{0}\right)\dot{f}\left(x_{0}\right) + \tau,
\]
donde \(\tau\) es el error de truncamiento
\[
\tau = \frac{\left(x_{1} - x_{0}\right)^{2}}{2!}\ddot{f}\left(\xi \right), \quad \xi\in\left[x_{0}, x_{1}\right].
\]
Recordando que \(h = x_{1} - x_{0}\), las ecuación anterior queda definida como sigue
\[
\dot{f}\left(x_{0}\right) = \frac{f\left(x_{1}\right) - f\left(x_{0}\right)}{h} - \frac{h}{2}\ddot{f}\left(\xi\right)
\]
Es posible obtener el método de Euler directo utilizando una variación de la interpolación de Lagrange llamada diferencia dividida.
Podemos aproximar cualquier función \(f(x)\) utilizando un polinomio de grado \(P_{n}(x)\) y un término de error
\[\begin{split}
\begin{aligned}
f(x) &= P_{n}(x) + \text{error}, \\
&= f\left(x_{0}\right) + f\left[x_{0}, x_{1}\right]\left(x - x_{0}\right) + f\left[x_{0}, x_{1}, x_{2}\right]\left(x - x_{0}\right)\left(x - x_{1}\right), \\
&+ \cdots + f\left[x_{0},\dots,x_{n}\right]\prod_{i=0}^{n-1}\left(x - x_{1}\right) + \text{error},
\end{aligned}
\end{split}\]
donde
\[\begin{split}
\begin{aligned}
f\left[x_{0}, x_{1}\right] &= \frac{f\left(x_{1}\right) - f\left(x_{0}\right)}{x_{1} - x_{0}}, \\
f\left[x_{0}, x_{1}, x_{2}\right] &= \frac{f\left[x_{1},x_{2}\right] - f\left[x_{0},x_{1}\right]}{x_{2} - x_{0}}, \\
f\left[x_{0}, x_{1}, \dots, x_{n}\right] &= \frac{f\left[x_{1},x_{2},\dots,x_{n}\right] - f\left[x_{0},x_{1},\dots,x_{n-1}\right]}{x_{n} - x_{0}}. \\
\end{aligned}
\end{split}\]
Derivando \(P_{n}(x)\), tenemos
\[\begin{split}
\begin{aligned}
\dot{P}_{n}(x) &= f\left[x_{0},x_{1}\right] + f\left[x_{0},x_{1},x_{2}\right]\left\{\left(x - x_{0}\right) + \left(x - x_{1}\right) \right\}, \\
&+ \cdots + f\left[x_{0},\dots,x_{n}\right]\sum_{i=0}^{n-1} \frac{\left(x - x_{0}\right)\dots\left(x - x_{n-1}\right)}{\left(x - x_{i}\right)},
\end{aligned}
\end{split}\]
por consiguiente el error se define como sigue
\[
\text{error} = \left(x - x_{0}\right)\dots\left(x - x_{n}\right)\frac{f^{n+1}\left(\xi\right)}{\left(n + 1\right)!}.
\]
Definimos entonces la primer derivada como sigue
\[
\dot{f}(x) = \left[x_{0}, x_{1}\right] = \frac{f\left(x_{1}\right) - f\left(x_{0}\right)}{x_{1} - x_{0}},
\]
lo que implica
\[
\dot{f}(x) = \frac{f\left(x_{1}\right) - f\left(x_{0}\right)}{x_{1} - x_{0}} + O\left(h\right), \quad \text{Euler},
\]
\[
\dot{f}(x) = \frac{f\left(x_{1}\right) - f\left(x_{-1}\right)}{x_{1} - x_{-1}} + O\left(h^{2}\right), \quad \text{Central}.
\]
Utilizando el mismo método, obtenemos una aproximación a la segunda derivada como sigue
\[
\ddot{f}\left(x_{0}\right) = \frac{f_{2} - 2f_{1} + f_{0}}{h^{2}} + O\left(h^{2} \right),
\]
\[
\ddot{f}\left(x_{0}\right) = \frac{f_{1} - 2f_{0} + f_{-1}}{h^{2}} + O\left(h^{2} \right), \quad \text{central}.
\]
Ejemplo
Resuelva numéricamente la ecuación diferencial de primer orden
\[\begin{split}
\begin{aligned}
\dot{y} = f\left(x,y\right), \\
a \leq x \leq b.
\end{aligned}
\end{split}\]
Ejemplo
Aplique la fórmula de Euler a la ecuación de primer orden con una entrada oscilante
\[
\dot{y} = \sin(x), \quad 0 \leq x \leq 10.
\]
Ejemplo
El crecimiento demográfico simple está descrito por una ecuación diferencial de primer orden de la forma
\[
\dot{y} = \varepsilon y,
\]
cuya solución exacta está dada por
\[
y = Ce^{\varepsilon x}.
\]
Dada la siguiente condición inicial
\[
y\left(0\right) = 1,
\]
con una tasa de cambio de \(\varepsilon = 0.5\), la solución analítica queda expresada como sigue
\[
y = e^{0.5 x}.
\]
Aplique la fórmula de Euler para obtener una solución aproximada.
Método de Runge-Kutta
El método de Runge-Kutta (RK) está relacionado con la expansión de la serie de Taylor, con la diferencia de que no es necesaria la diferenciación de \(f\).
Los métodos RK se escriben de la siguiente forma
\[
w_{n+1} = w_{n} + hF\left(t,w,h; f\right), \quad n\geq 0,
\]
donde el error de truncamiento está definido por
\[
T_{n}\left(y\right) = y\left(t_{n+1}\right) - y\left(t_{n}\right) - hF\left(t_{n},y\left(t_{n}\right),h;f\right),
\]
tal que el error está dado como sigue \(\tau_{n}\left(y\right)\)
\[
T_{n} = h\tau_{n}\left(y\right).
\]
Reescribiendo términos, tenemos
\[
y\left(t_{n+1}\right) = y\left(t_{n}\right) - hF \left(t_{n}, y\left(t_{n}\right), h; f \right) + h\tau_{n}\left(y\right).
\]
Considere el método explícito de un paso
\[
\frac{w_{i+1} - w_{i}}{h} = F\left(f, t_{i}, w_{i},h \right),
\]
con
\[
F\left(f, t, y, h \right) = a_{0}k_{1} + a_{1}k_{2},
\]
\[
F\left(f, t, y, h \right) = a_{0}\left(t, y \right) + a_{1}\left(t + \alpha_{1}, y + \beta_{1} \right),
\]
donde \(\alpha_{0} + \alpha_{1} = 1\).
Importante
En la formulación del método de Runge-Kutta existe un parámetro libre. En este caso, \(\alpha_{0}\).
Theorem 2
Sea \(f\left(t,y\right)\) y todas sus derivadas parciales de orden menor o igual a \(n+1\) continuas sobre \(D = \left\{ \left(t,y \right) | a \leq t \leq b, c \leq y \leq d \right\}\) y sea \(\left(t_{0}, y_{0}\right)\in D\) para cada \(\left(t, y\right) \in D\), \(\exists \xi \in \left(t, t_{0}\right)\) y \(\mu \in \left(y, y_{0}\right)\) con
\[
f\left(t,y\right) = P_{n} \left(t,y\right) + R_{n}\left(t,y\right),
\]
donde
\[\begin{split}
\begin{aligned}
P_{n}\left(t,y\right) &= f\left(t_{0},y_{0}\right) + \left[ \left(t - t_{0}\right) \frac{\partial f}{\partial t}\left(t_{0},y_{0}\right) + \left(y - y_{0}\right)\frac{\partial f}{\partial y}\left(t_{0}, y_{0}\right) \right] \\
&+ \left[ \frac{\left(t -t_{0}\right)^{2}}{2}\frac{\partial^{2}f}{\partial t^{2}}\left(t_{0}, y_{0}\right) + \left(y - y_{0}\right)\left(t - t_{0}\right) \frac{\partial^{2} f}{\partial y\partial t}\left(t_{0}, y_{0}\right) \right. \\
&+ \left. \frac{\left(y - y_{0}\right)^{2}}{2}\frac{\partial^{2} f}{\partial y^{2}} \left(t_{0}, y_{0} \right) \right] \\
&+ \dots + \\
&+ \left[ \frac{1}{n!} \sum_{j=0}^{n} \binom{n}{j} \left(t - t_{0}\right)^{n-j}\left(y - y_{0}\right)^{j}\frac{\partial^{n} f}{\partial y^{j}\partial t^{n-j}}\left(t_{0},y_{0}\right) \right].
\end{aligned}
\end{split}\]
Podemos utilizar el Theorem 2 para encontrar los valores \(a_{1}\), \(\alpha_{1}\) y \(\beta_{1}\) considerando que \(\alpha_{1}f\left(t+\alpha_{1}, y + \beta_{1}\right)\) aproxima a Taylor de segundo orden
\[
f\left(t,y\right) + \frac{h}{2}\dot{f}\left(t,y\right)
\]
con un error no mayor a \(O\left(h^{2}\right)\).
Utilizando
\[
\dot{f}\left(t,y\right) = \frac{\partial f}{\partial t}\left(y,t\right) + \frac{\partial f}{\partial y}\left(t,y\right)\dot{y}(t),
\]
la expresión de Taylor de segundo orden se puede escribir como sigue
\[
f\left(t,y\right) + \frac{h}{2}\frac{\partial f}{\partial t}\left(y,t\right) + \frac{h}{2}\frac{\partial f}{\partial y}\left(t,y\right)f\left(t,y\right).
\]
Expandiendo \(\alpha_{1}f\left(t+\alpha_{1}, y + \beta_{1}\right)\) y su polinomio de Taylor de grado uno alrededor de \(\left(t,y\right)\), tenemos
\[
\alpha_{1}f\left(t+\alpha_{1}, y + \beta_{1}\right) = \alpha_{1}f\left(t, y\right) + a_{1}\alpha_{1}\frac{\partial f}{\partial t}\left(t, y\right) + a_{1}\beta_{1}\frac{\partial f}{\partial y} + a_{1}R_{1}\left(t + \alpha_{1}, y + \beta_{1}\right),
\]
donde
\[
R_{1}\left(t + \alpha_{1}, y + \beta_{1} \right) = \frac{\alpha_{1}^{2}}{2}\frac{\partial^{2}f}{\partial t^{2}}\left(\xi, \mu \right) + \alpha_{1}\beta_{1} \frac{\partial^{2}f}{\partial t\partial y}\left(\xi,\mu \right) + \frac{\beta_{1}^{2}}{2}\frac{\partial^{2}f}{\partial y^{2}}\left(\xi,\mu \right),
\]
para algún \(\xi \in \left[t,t + \alpha_{1} \right]\) y \(\mu \in \left[y,y + \beta_{1} \right]\).
Los métodos de orden mayor se obtienen de forma similar. Por ejemplo, Runge-Kutta de tercer orden se expresa como sigue
\[
\frac{w_{i+1} - w_{i}}{h} = F\left(f, t_{i}, w_{i}, h \right),
\]
con
\[
F\left(f, t, w, h \right) = a_{0}k_{1} + a_{1}k_{2} + a_{2}k_{3},
\]
donde
\[
a_{0} + a_{1} + a_{2} = 1,
\]
\[\begin{split}
\begin{aligned}
k_{1} &= f\left(t_{i}, w_{i} \right), \\
k_{2} &= f\left(t_{i} + \alpha_{1}h, t_{i} + \beta_{11}k_{1} \right), \\
k_{3} &= f\left(t_{i} + \alpha_{2}h, t_{i} + \beta_{21}k_{1} + \beta_{22}k_{2} \right).
\end{aligned}
\end{split}\]
Escogiendo \(\alpha_{2} = 1\), \(\beta_{11} = \frac{1}{2}\), obtenemos la siguiente ecuación
\[
w_{i+1} = w_{i} + \frac{h}{6}\left(k_{1} + 4k_{2} + k_{3} \right),
\]
donde
\[\begin{split}
\begin{aligned}
k_{1} &= f\left(t_{i}, w_{i} \right), \\
k_{2} &= f\left(t_{n} + \frac{h}{2}, w_{n} + \frac{h}{2}k_{1} \right), \\
k_{3} &= f\left(t_{n} + h, w_{n} - hk_{1} + 2hk_{2} \right). \\
\end{aligned}
\end{split}\]
Para obtener el método de Runge-Kutta de cuarto orden, consideramos
\[\begin{split}
\begin{aligned}
w_{0} &= \alpha, \\
k_{1} &= hf\left(t_{i}, w_{i} \right), \\
k_{2} &= hf\left(t_{i} + \frac{h}{2}, w_{i} + \frac{k_{1}}{2} \right), \\
k_{3} &= hf\left(t_{i} + \frac{h}{2}, w_{i} + \frac{k_{2}}{2} \right), \\
k_{4} &= hf\left(t_{i+1}, w_{i} + k_{3} \right), \\
w_{i+1} &= w_{i} + \frac{1}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4} \right).
\end{aligned}
\end{split}\]