Answer :

To solve the problem, we start with the given equation:

[tex]\[ \frac{x}{y} + \frac{y}{x} = 3 \][/tex]

Let's introduce new variables for simplicity:

[tex]\[ p = \frac{x}{y} \quad \text{and} \quad q = \frac{y}{x} \][/tex]

Thus, the given equation becomes:

[tex]\[ p + q = 3 \][/tex]

Next, we will square both sides of the equation [tex]\( p + q = 3 \)[/tex]:

[tex]\[ (p + q)^2 = 3^2 \][/tex]

Expanding the left-hand side, we get:

[tex]\[ p^2 + 2pq + q^2 = 9 \][/tex]

We know that [tex]\( p \cdot q = \left(\frac{x}{y}\right) \cdot \left(\frac{y}{x}\right) = 1 \)[/tex], because multiplying [tex]\(\frac{x}{y}\)[/tex] and [tex]\(\frac{y}{x}\)[/tex] gives us 1. So, we can substitute [tex]\( pq = 1 \)[/tex] into the equation:

[tex]\[ p^2 + 2pq + q^2 = 9 \][/tex]

Since [tex]\( pq = 1 \)[/tex]:

[tex]\[ p^2 + 2 \cdot 1 + q^2 = 9 \][/tex]

This simplifies to:

[tex]\[ p^2 + q^2 + 2 = 9 \][/tex]

By isolating [tex]\( p^2 + q^2 \)[/tex], we get:

[tex]\[ p^2 + q^2 = 9 - 2 \][/tex]

Thus:

[tex]\[ p^2 + q^2 = 7 \][/tex]

Recall that [tex]\( p = \frac{x}{y} \)[/tex] and [tex]\( q = \frac{y}{x} \)[/tex]. Accordingly, [tex]\( p^2 = \left(\frac{x}{y}\right)^2 = \frac{x^2}{y^2} \)[/tex] and [tex]\( q^2 = \left(\frac{y}{x}\right)^2 = \frac{y^2}{x^2} \)[/tex].

Therefore:

[tex]\[ \frac{x^2}{y^2} + \frac{y^2}{x^2} = p^2 + q^2 \][/tex]

Finally:

[tex]\[ \frac{x^2}{y^2} + \frac{y^2}{x^2} = 7 \][/tex]

So, the value of [tex]\( \frac{x^2}{y^2} + \frac{y^2}{x^2} \)[/tex] is:

[tex]\[ \boxed{7} \][/tex]