I tested it. Realm rank is based on whatever spot you take from a player in your realm. If you defeat the player in your realm who is #1 in realm rank, you move up to #1 in realm rank just like before.
The confusion starts when the player who is #1 in your realm could be any rank in ultimate arena. So the player who is #1 in realm rank could be #30 in ultimate arena because players in other realms can bump that player around in ultimate arena without changing your realm rank.
That is what I suspected was happening. Thanks for the info.
The opinions expressed on this post are my own as a player, not as a Moderator.