I'm doing homework about L'Hôpital's rule and there's a question that I'm not sure I answered right.

I had to find the limit of (x^2 \* sin(1/x))/sin(x) as x approaches 0, and after L'Hôpital

(2x \* sin(1/x) + x^2 \* cos(1/x))/cos(x)

Here I realized that I could use the rule as much as I wanted but the discontinuities in the numerator were always gonna be an issue. However, since the limit of 1/x is infinity as x approaches 0 and the limit of sin and cos is undefined at infinity, I thought I could just ignore those undefined terms and take the limit with the rest of the function. I got the right result, but I'd like to know if my logic is correct and how I should write it formally if it is. I just took out sin(1/x) and cos(1/x) and computed the limit without them.
>2x * sin(1/x) + x^2 * cos(1/x)

That's not the derivative of x^2 sin(1/x) btw (you're forgetting something)

>but the discontinuities in the numerator were always gonna be an issue

There's only one discontinuity in the numerator, and it's at 0, so what's the issue?

>I thought I could just ignore those undefined terms and take the limit with the rest of the function

When can you ever ignore terms just because they're difficult to deal with or understand?

Question: How did you know L'Hospital's rule was appropriate in the first place?
It's limit as x approaches 0 of x/sin(x) × x sin(1/x)

You can rewrite the last one as y=1/x, and get limit as y approaches infinity of sin(y)/y.