Please help me with this question related to RSA. $p=13$, $q=19$ $x=(p-1)(q-1)=216$ $N=p*q=247$ So three values of $e$ were given in the question $37,38,39$ using the fact $\gcd(x,e)$ , I found the value of $e=37$. So $e=37$ and I calculated $d$ which is equal to $181$. Is the value of $d$ correct? Then when I started encoding the message using 102(power 37)mod(247), I got the result = $102$.
How is this even possible? Please tell me my mistake.
Indeed among the three numbers, only $37$ has $\gcd(37, \phi(N)) = 1$, where $\phi(N) = (p-1)(q-1)$. Indeed $181 \cdot 37 = 1 \pmod{\phi(N)}$, so your $d$ is correct.
No mistake, indeed $102^{37} = 102 \pmod{N}$ and also $102^{181} = 102 \pmod{N}$ (so "decryption" also works).
You just happen to have a fixed point for RSA. There are always
$(1+\gcd(e-1,p-1))(1+\gcd(e-1,q-1))$ of them,see this answer. $1$ is always one. In this case $p-1 | e$ and $q-1 | e$ so all points are fixed points. This never happens in praxis, as then $p,q$ are chosen so that $p-1$ only has one prime factor, besides 2, and likewise for $q-1$. And $e=2^{16}+1$ or $e=3$ is chosen, so that $\gcd(e-1, p-1) = 2 = \gcd(e-1, q-1)$, and there are very few (9, among which $0,1$) fixed points. Plus messages are padded to look random, os the fixed points will rarely be hit. But it's a weird example to use; only for such small numbers we can make an "identity" RSA. But it's very atypical.