Just one more thing, so the nonce has nothing to do with the difficulty number right?
Correct.
so nonce can be greater than difficulty value? they are not related at all? if they are not related what is the maximum number a nonce can be?
Currently, the difficulty is
6,727,225,469,722.
And the nonce is a 4 byte (32 bit) number. So max value = 4.294.967.295
The nonce CAN be greater than the difficulty IF the difficulty is extremely low.
But nonce and difficulty are not related at all..
when the miner decides to change something in the block?
When he has tried out all nonces without a single one leading to a hash below the current target.