Evaluate the limit $\lim_{x\rightarrow \frac{\pi}{2}}-(x-\frac{\pi}{2})\cdot\frac{\ln(\cos(x))}{x^2}$ I am kind of unsure about my solution to this problem and would love some feedback:
$x\in(-\frac{\pi}{2},\frac{\pi}{2})$
$\lim_{x\rightarrow \frac{\pi}{2}}-(x-\frac{\pi}{2})\cdot\frac{\ln(\cos(x))}{x^2}$
What makes me unsure is the fact that $\cos(\frac{\pi}{2})=0$ and that $\ln(0)$ is undefined.
Just by looking at a graph, it looks like the answer should be zero.
I also come up with the following solution, but I am not quite sure about it (due to the fact that $\ln(\cos(\frac{\pi}{2}))=Ø$ (not defined)
The solution I've come up with so far goes like:
$\lim_{x\rightarrow \frac{\pi}{2}}-(x-\frac{\pi}{2})\cdot\frac{\ln(\cos(x))}{x^2}$
$=-1\cdot \lim_{x\rightarrow \frac{\pi}{2}}(x-\frac{\pi}{2})\cdot\frac{\ln(\cos(x))}{x^2}$ Using the following rule to rewrite $a\cdot b=\frac{a}{\frac{1}{b}} b\neq0$
$=-1\cdot\lim_{x\rightarrow \frac{\pi}{2}}=\frac{(x-\frac{\pi}{2})}{\frac{1}{\frac{\ln(\cos(x))}{x^2}}}$
$-1\cdot\lim_{x\rightarrow \frac{\pi}{2}}=\frac{(x-\frac{\pi}{2})}{\frac{x^2}{\ln(\cos(x))}}$
Using the chain rule for limits I found the following expression:
$-1\cdot\lim_{x\rightarrow \frac{\pi}{2}}=\frac{(x-\frac{\pi}{2})}{\frac{x^2}{\ln(u)}}$
$\ln(u)=\ln(0)-\infty$ (This is the part where I feel like I'm on thin ice)
Substituting back into the expression above:
$-1\cdot\lim_{x\rightarrow \frac{\pi}{2}}=\frac{(x-\frac{\pi}{2})}{\frac{x^2}{-\infty}}$ (This is also a part where I suspect my notation is kind of bad.)
$-1\cdot\lim_{x\rightarrow \frac{\pi}{2}}=\frac{(x-\frac{\pi}{2})}{\frac{x^2}{-\infty}}\underset{x\rightarrow \frac{\pi}{2}}{\rightarrow}0$
So my questions are

*

*Is this a valid answer? If not: Is there someone who can provide me with a better solution (If possible with a step-by-step solution)?

*If my notation is off anywhere, I would love some feedback. I'm a fresh student trying to learn as much as possible, so some productive feedback would be nice. (Please be nice and keep in mind that I am a fresh student just starting his calculus course)

If there are some out there who are kind enough to give me the feedback I'm hoping for, I would be very grateful.
 A: You should use L'Hopital's rule, which states that if $\lim_{x\to a}f(x)=\infty$ and $\lim_{x\to a}g(x)=\infty$, then $$\lim_{x\to a}\frac{f(x)}{g(x)}=\lim_{x\to a}\frac{f^{\prime}(x)}{g^{\prime}(x)}$$ if the limit is finite, $+\infty$ or $-\infty$. This also holds if instead $\lim_{x\to a}f(x)=0$ and $\lim_{x\to a}g(x)=0$.
$$\begin{align}{\lim_{x\rightarrow \frac{\pi}{2}}-(x-\frac{\pi}{2})\cdot\frac{\ln(\cos(x))}{x^2}}&=-\frac{\lim_{x\rightarrow \frac{\pi}{2}}(x-\frac{\pi}{2})\cdot{\ln(\cos(x))}}{\lim_{x\to \frac{\pi}{2}}x^2}\\&=-\frac{4}{{\pi}^2}\lim_{x\rightarrow \frac{\pi}{2}}(x-\frac{\pi}{2})\cdot{\ln(\cos(x))}\\&=-\frac{4}{{\pi}^2}\lim_{x\to \frac{\pi}{2}}\frac{\ln(\cos(x))}{\frac{1}{x-\frac{\pi}{2}}}\\&=-\frac{4}{{\pi}^2}\lim_{x\to \frac{\pi}{2}}\frac{(\frac{-\sin(x)}{\cos(x)})}{(\frac{-1}{(x-\frac{\pi}{2})^2})}\\&=-\frac{4}{{\pi}^2}\lim_{x\to \frac{\pi}{2}}\frac{(x-\frac{\pi}{2})^2\sin(x)}{\cos(x)}\\&=-\frac{4}{{\pi}^2}\lim_{x\to \frac{\pi}{2}}\frac{2(x-\frac{\pi}{2})\sin(x)+(x-\frac{\pi}{2})^2\cos(x)}{-\sin(x)}\\&=-\frac{4}{{\pi}^2}\lim_{x\to \frac{\pi}{2}}\frac{0+0}{-1}\\&=0\end{align}$$Here L'Hopital's rule is used twice.
Feedback: Don't use $\infty$ when doing calculations, only when $\infty$ is the result of some limit, e.g. $$\lim_{x\to \infty}x=\infty.$$
A: You have written some gibberish of a kind that is common among students' attempts, which only means you need some more instruction: (1). Never put $\infty$ in an arithmetic expression with real numbers. There are no infinities in $\Bbb R$. The use of $\pm\infty$ in terms like $\lim_{r\to\infty}$ is an abbreviation, a "figure of speech". (2). If $A(x)\to 0$ and $B(x)\to 0$ as $x\to K,$ for example if $A(x)=x-\pi /2$ and $B(x)=x^2/\ln\cos x$ and $K=\pi/2,$ then $A(x)/B(x)$ might converge to $anything$ or fail to converge at all, as $x\to K$. You have to look into the properties of the particular $A(x)$ & $B(x).$
Assume $0<x<\pi /2$ so that $\cos x>0$ so that $\ln\cos x$ exists.
If $L=\lim_{x\to (\pi/2)^-} -(x-\pi /2) \ln\cos x$ exists then $\lim_{x\to (\pi/2)^-} -(x-\pi /2) \frac {\ln\cos x}{x^2}=L/(\pi/2)^2.$
Let $x=\pi/2 -y$. Then  $-(x-\pi /2) \ln\cos x=y\ln\sin y$ and $y\to 0^+$ as $x\to (\pi/2)^-.$
Now $\sin y =y(1+f(y))$ where $f(y)\to 0$ as $y\to 0$ because $\lim_{y\to 0}\frac {\sin y}{y}=1.$
So we have $y\ln\sin y=y\ln y +y\ln (1+f(y)).$
Now $\ln (1+f(y))\to 0$ as $y\to 0$ so the term $y\ln (1+f(y))\to 0$ too. This leaves the term $y\ln y,$which also $\to 0$ as $y\to 0^+,$ and there are many ways to show this.
