If $P\subset A$ is a prime ideal and $S\subset A$ is a multiplicatively closed subset with $P\cap S=\emptyset$, why is $A_P\cong S^{-1}A_{S^{-1}P}$?

This question is from my assignment on localization and I am not very good in attempting problems of localization. As, I am self studying, so I am posting them here for help.

Let $A$ be a commutative ring and let $S\subseteq A$ be a multiplicatively closed subset. Let $P\in \operatorname{Spec} A$ with $S\cap P=\emptyset$. Then the natural map $i: A \to S^{-1} A$ induces an isomorphism of rings $A_P \to(S^{-1} A)_{S^{-1}P}$.

Work: $P$ belongs to $\operatorname{Spec} A$ means that $P$ is a prime ideal and natural map is $a\to a/1$. $A_P$ is a ring $P^{-1} A$.

But what is meant by the $S^{-1} P$ in subscript of $(S^{-1} A)$? I think it means the same what $P$ means in $A_P$.

Now, $(S^{-1} A)_{S^{-1}P}= ({S^{-1} P} )^{-1} S^{-1} A$.

$S^{-1} (S^{-1}P)^{-1}=S^{-1}$ as $S^{-1} P $ is an ideal in $S$. So,$({S^{-1} P} )^{-1} S^{-1} A= S^{-1}A$.

Now the map will be clearly be an isomorphism as $P^{-1} A \subseteq S^{-1}A$ and the map is $a\to a$.

Is the proof fine? If not, can you tell me how to approach this correctly?


As Moises explained in the comments, for a prime ideal $P\subset A$, the notation $A_P$ means inverting $A\setminus P$, so your approach in the question is not correct.

You are correct in your assertion that $S^{-1}P$ "means the same" as $P$ does in $A_P$: as $S\cap P=\emptyset$, $S^{-1}P$ is a prime ideal of $S^{-1}A$ and so we can localize at it.

To finish the question, the map $i:A\to S^{-1}A$ is by $a\mapsto a/1$ as you claim. The induced map $i_P:A_P\to (S^{-1}A)_{S^{-1}P}$ is of the form $a/q\mapsto \frac{a/1}{q/1}$. We can construct a two-sided inverse as follows: given an element $\frac{a/s}{q/t}$ with $s,t\in S$ and $q\in A\setminus P$, we have $\frac{a/s}{q/t}=\frac{at/1}{qs/1}$, and as $S\cap P=\emptyset$, $qs\in A\setminus P$. So we can define a map $(S^{-1}A)_{S^{-1}P}\to A_P$ by $\frac{a/s}{q/t}\mapsto (at)/(qs)$, and it's quick to verify that this map is a two-sided inverse to the map $a/q\mapsto \frac{a/1}{q/1}$. So $i$ induces an isomorphism as claimed.