My current understanding is thus:
The accounting equation is
Assets = Liabilities + Equity
I take this from https://en.wikipedia.org/wiki/Accounting_equation. I think we take this as the definition of equity.
GnuCash agrees with that equation in its "static" equation. See https://www.gnucash.org/docs/v3/C/gnucash-guide/basics-accounting1.html#accounting_equation_static.
So far, this agrees with @Phillipp's answer from 2015.
But then they disagree with this when we get to their dynamic equation, at https://www.gnucash.org/docs/v3/C/gnucash-guide/basics-accounting1.html#accounting_equation_dynamic, which is
Assets - Liabilities = Equity + (Income - Expenses)
But for most of the year, this is what GnuCash's usage of equity actually obeys. So almost all of the time, GnuCash's definition of equity is in disagreement with the accounting equation, and @phillipp.
In other words, we have something like,
AccountingEquity = GnuCashEquity + (Income - Expenses)
They mostly only agree when GnuCash users have zeroed out their income and expense accounts. This could be situations such as, when users first add their opening balance, or, when they have closed out their books at end of year.
See also this answer, where they have pointed out the same issue: https://money.stackexchange.com/a/23996/90768
You'll find a similar point about GnuCash raised in http://gnucash.1415818.n4.nabble.com/how-to-automatically-update-equity-account-as-each-transaction-is-entered-td4684200.html.
Income and Expenses are actually temporary Equity accounts. At the end of the current period, they are normally closed( i.e. their balances are transferred) to an Equity:Retained Earnings account.
Another way to put all this might be, GnuCash's equity is your net worth, but missing any recent profits and losses that have not been closed.
Perhaps this is fine. Consider the following from https://en.wikipedia.org/wiki/Equity_(finance)#Shareholders'_equity.
Shareholders' equity is obtained by subtracting total liabilities from
the total assets of the shareholders. These assets and liabilities
- Equity (beginning of year)
- + net income
- - dividends
- +/− gain/loss from changes to the number of shares outstanding.
- = Equity (end of year) if one gets more money during the year or less or not anything
This suggests it is formal enough to interpret GnuCash's equity as the beginning of year equity.
I'm not sure how closing out is done in GnuCash, but compare this answer for ledger-cli, which presumably inherits the account structure from GnuCash. From https://ledger-cli.narkive.com/8fhP7Yhq/year-end-book-closing,
As the last entry of the year on the
ledger file I want to do a standard book closing. To take total income
and total expenses and use these to zero out the income and expenses
accounts and add the total of these to the equity account.
So I think you want to add a transaction at end of year, which zeros out income and expenses, and adds their complement to equity.
As for how to do this in GnuCash, a search for "gnucash close books" gives me results such as,