Could you tell me how to write the following P in Latex?
It is not equal to \mathcal{P} in Latex.
This is a \mathcal{P}. Note that depending on the font used, \mathcal{P} looks different.
If for example you just open a new document on overleaf.com and you edit "\mathcal{P}" into the source code, you will get:
That looks exactly like the letter that you want.
An minimal example to get this letter is:
\documentclass{article}
\begin{document}
$\mathcal{P}$
\end{document}
I think it is \mathcal{}
\begin{document}
$\mathcal{P}$
\[\mathcal{P}\]
\end{document}