15 Q-function

Q(s,a)←Q(s,a)+α[r+γmaxa′Q(s′,a′)−Q(s,a)]Q(s, a) \leftarrow Q(s, a) + \alpha [ r + \gamma \max_{a'} Q(s', a') - Q(s, a) ] Q-learning is off-policy (learns about a different policy than the one it uses to choose actions during training).

The Q values converge to the optimal Q values - the values corresponding to always acting greedily - even though the agent spent training acting suboptimally due to exploration.