Users can cache the current balance of their account, calculated from the sum of balances in the linked UTXO addresses. (The cache balance operation can be done on the whole account or only part, e.g. cache the balance of a specific asset from linked addresses). This is a (non-simple) write transaction that the core validators verify by checking the linked addresses against the current UTXO set. A timestamp and the current ledger state head is logged along with the write.
The cached balance does not show the current active balance in an account but rather at a snapshot in time and may be out of date. This will be tracked by balance witnesses in the future.
Public balances are computed from UTXOs that are non-confidential transactions. Private balances are computed from UTXOs that are confidential transactions. This is a cryptographic commitment. It is calculated from the cryptographic commitments in each UTXO output using the homomorphic properties of cryptographic commitments.