The given differential equation is:
\[
\frac{dy}{dx} = \frac{x^2 + y^2}{2xy}.
\]
1. Rewrite the Equation:
Divide numerator and denominator by \( x^2 \) to simplify:
\[
\frac{dy}{dx} = \frac{1 + \left(\frac{y}{x}\right)^2}{2 \cdot \frac{y}{x}}.
\]
Let \( v = \frac{y}{x} \), so \( y = vx \) and \( \frac{dy}{dx} = v + x\frac{dv}{dx} \).
Substitute into the equation:
\[
v + x\frac{dv}{dx} = \frac{1 + v^2}{2v}.
\]
2. Simplify the Equation:
Rearrange to isolate \( \frac{dv}{dx} \):
\[
x\frac{dv}{dx} = \frac{1 + v^2}{2v} - v.
\]
Simplify the right-hand side:
\[
x\frac{dv}{dx} = \frac{1 + v^2 - 2v^2}{2v} = \frac{1 - v^2}{2v}.
\]
Divide through by \( x \):
\[
\frac{dv}{dx} = \frac{1 - v^2}{2vx}.
\]
3. Separate Variables:
Separate \( v \) and \( x \):
\[
\frac{2v}{1 - v^2} \, dv = \frac{1}{x} \, dx.
\]
4. Integrate Both Sides:
- The left-hand side:
\[
\int \frac{2v}{1 - v^2} \, dv = \int \frac{-d(1 - v^2)}{1 - v^2}.
\]
Using substitution, this becomes:
\[
\int \frac{-d(1 - v^2)}{1 - v^2} = -\ln|1 - v^2|.
\]
- The right-hand side:
\[
\int \frac{1}{x} \, dx = \ln|x|.
\]
Combine the results:
\[
-\ln|1 - v^2| = \ln|x| + C,
\]
where \( C \) is the constant of integration.
5. Simplify:
Rewrite the equation:
\[
\ln|1 - v^2| = -\ln|x| - C.
\]
Exponentiate both sides:
\[
|1 - v^2| = \frac{K}{x},
\]
where \( K = e^{-C} \) is a constant.
6. Substitute Back \( v = \frac{y}{x} \):
Replace \( v \) with \( \frac{y}{x} \):
\[
1 - \left(\frac{y}{x}\right)^2 = \frac{K}{x}.
\]
Multiply through by \( x^2 \):
\[
x^2 - y^2 = Kx.
\]
General Solution:
\[
x^2 - y^2 = Kx,
\]
where \( K \) is an arbitrary constant.