Accounting for computer scientists (2011)
Double-entry accounting at its simplest is the accounting equation:<p><pre><code>  Assets = Liabilities + Equity
</code></pre>
Accounts are created that fall under one of these three categories. Each account has its own ledger to book transactions, and each ledger flows into a general ledger that keeps track of the account balances at a higher level.<p>Every transaction that is booked in a ledger must balance by issuing a debit and a credit.<p>Take Cash as an example. Cash is normally considered an asset account. Suppose you receive $10 in Cash temporarily from financing but you have an obligation to pay it back in the future. That obligation can be represented by a liability account called Accounts Payable. When receiving the cash, the following entry should be booked:<p><pre><code>  Cash $10
    Accounts Payable $10
</code></pre>
Here we have debited $10 to the Cash account and credited $10 to the Accounts Payable account. Both accounts balance. Revisiting the accounting equation, we can see how it still balances:<p><pre><code>  Assets = Liabilities + Equity
  10 = 10 + 0
</code></pre>
Now if we dive into the Cash account at a deeper level, we can represent it with a t-chart:<p><pre><code>     Cash   
  ---------
  10  |
</code></pre>
Similarly for Accounts Payable (A&#x2F;P)<p><pre><code>     A&#x2F;P   
  ---------
      |  10 
</code></pre>
Both Cash and Accounts Payable carry a balance of $10. Since Cash is an asset account that carries a debit balance, we represent it in t-chart form by adding 10 to the left side of the t-chart (matching up with assets being on the left side of the accounting equation). Accounts Payable carries a credit balance since it is a liability account, so we represent it by adding the 10 to the right side of the account (matching up with liabilities being on the right side of the accounting equation).<p>Next, lets look at what happens when we pay back $5 of our obligation. First, we book the following entry:<p><pre><code>  Accounts Payable $5
    Cash $5
</code></pre>
Now we have debited Accounts Payable and credited Cash, which is the opposite of their account types. This reduces the balance of the accounts, as demonstrated by their t-charts:<p><pre><code>     Cash          A&#x2F;P   
  ---------     ---------
  10  |             |  10 
      |   5      5  |
</code></pre>
The accounting equation is now:<p><pre><code>  Assets = Liabilities + Equity
  5 = 5 + 0
</code></pre>
Finally, let&#x27;s look at an equity account. Suppose when the business was formed, we gave it $10 of widgets (Inventory asset account) in exchange for equity in the business:<p><pre><code>  Inventory $10
    Equity $10

  Inventory       Equity
  ---------     ---------
  10  |             |  10

    Equity
  ---------
      |  10
</code></pre>
Pretending that the founding equity has now been introduced (because it would have normally been the first entry in the company&#x27;s books), the accounting equation is updated as so:<p><pre><code>  Assets = Liabilities + Equity
  15 = 5 + 10
</code></pre>
Now suppose we receive $20 in cash from the sale of all of our widgets valued at $10. Our business was formed to sell these widgets, so the sale is revenue. Revenue is an equity account. The sale would be booked with the following entry:<p><pre><code>  Cash $20
    Inventory $10
    Revenue   $10
</code></pre>
Since Revenue is an equity account, we have increased its balance by crediting it $10, which is the difference between the cash received and the value of the widgets we sold. The t-charts for the account balances in the transaction are the following:<p><pre><code>     Cash       Inventory
  ---------     ---------
  10  |         10  |
      |   5         |  10
  20  |

  Inventory  
  ---------
  10  |
      |  10

   Revenue
  ---------
      | 10
</code></pre>
What do you think the accounting equation looks like at this point? Think on it for a second.<p>Let&#x27;s close out our accounts before answering that question.<p>Assets:<p><pre><code>     Cash       Inventory  
  ---------     ---------
  10  |         10  |
      |   5         |  10
  20  |         ---------
  ---------            $0
  30  |   5     ---------
  ---------     ---------
        $25
  ---------
  ---------

 Liabilities:

     A&#x2F;P   
  ---------
     |  10 
  5  |
  ---------
         $5
  ---------
  ---------
</code></pre>
Equity:<p><pre><code>   Revenue        Equity
  ---------     ---------
      |  10         |  10
  ---------     ---------
        $10           $10
  ---------     ---------
  ---------     ---------
</code></pre>
At this point, the accounting equation remains perfectly balanced still:<p><pre><code>  Assets = Liabilities + Equity
  25 = 5 + 20
</code></pre>
From here, we could create a Balance Sheet (B&#x2F;S), which is a look at the balances of our accounts at a point in time.<p><pre><code>  ---------------
   Balance Sheet
  ---------------
  Assets:
  
  Cash         25
  Inventory     0
  ---------------
  Total       $25
  ---------------
  Liabilities:
  
  A&#x2F;P           5
  ---------------
  Total        $5
  ---------------
  Net assets: $20
  ---------------
  Equity:
  
  Equity       10
  R&#x2F;E          10
  ---------------
  Total       $20
</code></pre>
We can see a shift of the accounting equation on the B&#x2F;S with the net assets equaling the equity (Assets - Liabilities = Equity).<p>Hold on. Where did R&#x2F;E come from? That stands for Retained Earnings and represents the net profit as the end of the period measure by the Income Statement (I&#x2F;S). Similarly, the movement of Cash would be measured during the period in the Statement of Cash Flows (C&#x2F;F) with the ending cash position flowing into the Cash balance on the B&#x2F;S.<p>Accounting is more complex in reality of course, but I hope this provides a demonstration of how double-entry accounting works and how accountants think when performing bookkeeping functions. It&#x27;s really sort of a fun practice in a geeky way. It&#x27;s all about the flow of balancing things. Everything is accounted for, and these practices demonstrate how business resources are used.<p>Any questions?<p>Adapted from this blog post: <a href="https:&#x2F;&#x2F;www.winstoncooke.com&#x2F;blog&#x2F;2023-10-20-a-basic-introduction-to-accounting" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.winstoncooke.com&#x2F;blog&#x2F;2023-10-20-a-basic-introdu...</a>