Step 1: Separate the Variables
The given differential equation is:
\[
\frac{dy}{dx} = y \cot 2x.
\]
Separating the variables:
\[
\frac{dy}{y} = \cot 2x \, dx.
\]
Step 2: Integrate Both Sides
Integrating the left-hand side:
\[
\int \frac{dy}{y} = \ln |y|.
\]
Integrating the right-hand side:
\[
\int \cot 2x \, dx = \frac{1}{2} \ln |\sin 2x|.
\]
Thus, we get:
\[
\ln |y| = \frac{1}{2} \ln |\sin 2x| + C.
\]
Step 3: Solve for \( y \)
Exponentiating both sides:
\[
y = e^C \cdot |\sin 2x|^{1/2}.
\]
Let \( e^C = k \), so:
\[
y = k \sqrt{|\sin 2x|}.
\]
Step 4: Apply Initial Condition
Given that \( y\left(\frac{\pi}{4}\right) = 2 \), substitute \( x = \frac{\pi}{4} \):
\[
2 = k \sqrt{|\sin (\frac{\pi}{2})|}.
\]
Since \( \sin (\pi/2) = 1 \), we get:
\[
2 = k \cdot 1 \quad \Rightarrow \quad k = 2.
\]
Step 5: Final Particular Solution
Substituting \( k = 2 \):
\[
y = 2 \sqrt{|\sin 2x|}.
\]
Conclusion: The particular solution is:
\[
y = 2 \sqrt{|\sin 2x|}.
\]