# rss_item

guid: 66aafad22b234d0983de2970
title: Chart of Accounts for Startups and SaaS Companies
author: Neil Panchal
url: https://neil.computer/notes/chart-of-accounts-for-startups-and-saas-companies/
feedurl: https://neil.computer/rss/
enclosure_url: https://neil.computer/content/images/2023/09/1522px-General_store_interior_Alabama_USA.jpg
content_mime_type: text/html
content:
<figure class="kg-card kg-image-card"><img src="https://neil.computer/content/images/2023/09/1522px-General_store_interior_Alabama_USA-1.jpg" class="kg-image" alt="Chart of Accounts for Startups and SaaS Companies" loading="lazy" width="1522" height="1200" srcset="https://neil.computer/content/images/size/w600/2023/09/1522px-General_store_interior_Alabama_USA-1.jpg 600w, https://neil.computer/content/images/size/w1000/2023/09/1522px-General_store_interior_Alabama_USA-1.jpg 1000w, https://neil.computer/content/images/2023/09/1522px-General_store_interior_Alabama_USA-1.jpg 1522w" sizes="(min-width: 720px) 720px"></figure><img src="https://neil.computer/content/images/2023/09/1522px-General_store_interior_Alabama_USA.jpg" alt="Chart of Accounts for Startups and SaaS Companies"><p>Accounting is fundamental to starting a business. You need to have a basic understanding of accounting principles and essential bookkeeping. I had to learn it. There was no choice. For filing taxes, your CPA is going to ask you for an Income Statement (also known as P/L statement). If you&apos;re doing taxes by yourself, then the Income Statement serves as a crucial report for filing taxes.</p><p>There are many resources out there to get started with the Bookkeeping process, but I had to spend a lot of time organizing chart of accounts. You <em>need</em> to organize this upfront as it will be a huge mess to change later.</p><p>I searched for a high quality chart of accounts, but it was either A) Disorganized mess, B) Too broad with 500+ accounts for every possible business C) Organized but without Chart of Account numbers D) Meant for massive C-Corps. You won&apos;t be able to chatGPT out of it, trust me. </p><p>Account Numbers are a <em>must</em>. I am generally obsessed with naming things right, it has always served me well. When you&apos;re communicating to your CPA, you can refer to them precisely by numbers.</p><p>Here is mine, it&apos;s meant for a software based startup with a single-member LLC (passthrough tax entity). If you have more than one members in the LLC, just duplicate the &quot;Owner&apos;s&quot; accounts for each member; rename &quot;Owner&quot; to &quot;Member&quot;. If it is an S-Corp, change &quot;Owner&quot; to &quot;Shareholders&quot;. There are a few differences in terminology (e.g. Distributions vs. Draw), but you&apos;ll figure that out later. Accounts can be renamed at any time, just make sure the structure and type of account is correct. I use it for Quickbooks Desktop (not sold anymore), but there is no reason why it can&apos;t be used in any accounting software.</p>
<!--kg-card-begin: html-->
<table class="table">
    <thead>
        <tr>
            <th colspan="2">Account #</th>
            <th>Account Description</th>
            <th>Type</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1010</td>
            <td></td>
            <td>Stripe Account</td>
            <td>Bank</td>
        </tr>
        <tr>
            <td>1020</td>
            <td></td>
            <td>Checking Account #1</td>
            <td>Bank</td>
        </tr>
        <tr>
            <td>1030</td>
            <td></td>
            <td>Checking Account #2</td>
            <td>Bank</td>
        </tr>
        <tr>
            <td>1040</td>
            <td></td>
            <td>Savings Account #1</td>
            <td>Bank</td>
        </tr>
        <tr>
            <td>1100</td>
            <td></td>
            <td>Clearing Account</td>
            <td>Bank</td>
        </tr>
        <tr>
            <td>1200</td>
            <td></td>
            <td>Inventory Asset</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td>1410</td>
            <td></td>
            <td>Brokerage Account #1</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1411</td>
            <td>Cash</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1412</td>
            <td>Investments</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1413</td>
            <td>Unrealized Gains and Losses</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td>1490</td>
            <td></td>
            <td>ACH and Wire Clearing</td>
            <td>Other Current Asset</td>
        </tr>
        <tr>
            <td>1500</td>
            <td></td>
            <td>Computers and Equipment</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1510</td>
            <td>Computers</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1520</td>
            <td>Computers Acc Depreciation</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td>1600</td>
            <td></td>
            <td>Furniture and Fixtures</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1610</td>
            <td>Furniture</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td></td>
            <td>1620</td>
            <td>Furniture Acc Depreciation</td>
            <td>Fixed Asset</td>
        </tr>
        <tr>
            <td>2000</td>
            <td></td>
            <td>Accounts Payable</td>
            <td>Accounts Payable</td>
        </tr>
        <tr>
            <td>2100</td>
            <td></td>
            <td>Credit Card #1</td>
            <td>Credit Card</td>
        </tr>
        <tr>
            <td>2600</td>
            <td></td>
            <td>Due to Owner</td>
            <td>Short Term Liability</td>
        </tr>
        <tr>
            <td></td>
            <td>2610</td>
            <td>Expense Reimbursement</td>
            <td>Short Term Liability</td>
        </tr>
        <tr>
            <td>3000</td>
            <td></td>
            <td>Opening Balance Equity</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td>3100</td>
            <td></td>
            <td>Owner&apos;s Capital</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td></td>
            <td>3110</td>
            <td>Owner&apos;s Investments</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td></td>
            <td>3120</td>
            <td>Owner&apos;s Asset Contributions</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td>3200</td>
            <td></td>
            <td>Members Equity</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td>3300</td>
            <td></td>
            <td>Owner&apos;s Distributions</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td></td>
            <td>3310</td>
            <td>Owner&apos;s Withdrawals</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td></td>
            <td>3320</td>
            <td>Personal Expenses</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td>3400</td>
            <td></td>
            <td>Unrealized Gains and Losses</td>
            <td>Equity</td>
        </tr>
        <tr>
            <td>4000</td>
            <td></td>
            <td>Revenue</td>
            <td>Income</td>
        </tr>
        <tr>
            <td></td>
            <td>4010</td>
            <td>Non-Recurring Sales</td>
            <td>Income</td>
        </tr>
        <tr>
            <td></td>
            <td>4020</td>
            <td>Subscription Sales</td>
            <td>Income</td>
        </tr>
        <tr>
            <td></td>
            <td>4030</td>
            <td>Refunds and Allowances</td>
            <td>Income</td>
        </tr>
        <tr>
            <td>5000</td>
            <td></td>
            <td>Cost of Goods Sold</td>
            <td>Cost of Goods Sold</td>
        </tr>
        <tr>
            <td>5500</td>
            <td></td>
            <td>Payment Processing</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>5510</td>
            <td>Transaction Fees</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>5520</td>
            <td>Transaction Fee Allowances</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>5530</td>
            <td>Payment Services</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6000</td>
            <td></td>
            <td>Hosting and Cloud Computing</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6010</td>
            <td>Datacenter Colocation</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6020</td>
            <td>Cloud Services</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6030</td>
            <td>Website and Domains</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6100</td>
            <td></td>
            <td>Software and Subscriptions</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6110</td>
            <td>Software Applications</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6120</td>
            <td>Software Subscriptions</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6130</td>
            <td>Memberships</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6200</td>
            <td></td>
            <td>Office Supplies and Equipment</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6210</td>
            <td>Stationery</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6220</td>
            <td>Beverages and Canteen</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6230</td>
            <td>Shipping and Postage</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6240</td>
            <td>Office Electronics</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6250</td>
            <td>Small Office Equipment</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6300</td>
            <td></td>
            <td>Education and Training</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6310</td>
            <td>Books</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6320</td>
            <td>Media Subscriptions</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6330</td>
            <td>Courses and Seminars</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6400</td>
            <td></td>
            <td>Utilities</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6410</td>
            <td>Internet Service</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6420</td>
            <td>Telephone</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6430</td>
            <td>Mechanical and Electrical</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6500</td>
            <td></td>
            <td>Maintenance and Repair</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6510</td>
            <td>Appliance Maintenance</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6600</td>
            <td></td>
            <td>Meals</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6610</td>
            <td>Meals with Clients</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6700</td>
            <td></td>
            <td>Travel</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6710</td>
            <td>Transportation</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6720</td>
            <td>Lodging</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6800</td>
            <td></td>
            <td>Automobile</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6810</td>
            <td>Mileage Reimbursement</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6820</td>
            <td>Repairs and Maintenance</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>6900</td>
            <td></td>
            <td>Legal and Professional</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6910</td>
            <td>Taxes and Accounting</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>6920</td>
            <td>LLC Operations and Management</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7000</td>
            <td></td>
            <td>Advertising and Marketing</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7010</td>
            <td>Social Media Campaigns</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7020</td>
            <td>Website Advertisement</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7030</td>
            <td>Search Advertisement</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7200</td>
            <td></td>
            <td>Research and Development</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7210</td>
            <td>Materials and Supplies</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7600</td>
            <td></td>
            <td>Bank Service Charges</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7610</td>
            <td>Credit Card Allowances</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7620</td>
            <td>Bank Fees</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7700</td>
            <td></td>
            <td>State Taxes</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7800</td>
            <td></td>
            <td>Depreciation</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7810</td>
            <td>Furniture Depreciation</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7820</td>
            <td>Computer Depreciation</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>7900</td>
            <td></td>
            <td>Rent and Lease</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td></td>
            <td>7910</td>
            <td>Office Rent</td>
            <td>Expense</td>
        </tr>
        <tr>
            <td>8000</td>
            <td></td>
            <td>Non-Operating Income</td>
            <td>Other Income</td>
        </tr>
        <tr>
            <td></td>
            <td>8010</td>
            <td>Interest Income</td>
            <td>Other Income</td>
        </tr>
        <tr>
            <td></td>
            <td>8020</td>
            <td>Dividend Income</td>
            <td>Other Income</td>
        </tr>
        <tr>
            <td></td>
            <td>8030</td>
            <td>Other Non-Operating Income</td>
            <td>Other Income</td>
        </tr>
        <tr>
            <td>9000</td>
            <td></td>
            <td>Ask My Accountant</td>
            <td>Other Expense</td>
        </tr>
    </tbody>
</table>
<!--kg-card-end: html-->
<p></p><p>Feel free to use it in your company as long as following conditions are met:</p><p>In short: use it as you please for your company, no need to attribute me, don&apos;t sue me and don&apos;t sell this chart of accounts.</p><ul>
<li><strong>Grant of License</strong>: The licensor hereby grants you a perpetual, worldwide, non-exclusive, no-charge, and royalty-free license to use the Chart of Accounts template for any purpose, including for commercial purposes and within a company for bookkeeping, subject to the conditions herein.</li>
<li><strong>No Warranty &amp; No Liability</strong>: The Chart of Accounts template is provided &quot;as is&quot; without any warranties of any kind, either express or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose.</li>
<li><strong>Restrictions</strong>: You are expressly prohibited from selling the Chart of Accounts template, or any derivative thereof, as a standalone product. Redistribution of the Chart of Accounts in its original or altered form is not permitted unless it&apos;s a part of a larger system or product where the Chart of Accounts is not the primary value.</li>
</ul>
<p>Copyright 2023, Neil Panchal.</p>


guid: 66aafad22b234d0983de291a
title: Coming soon
author: Neil Panchal
url: https://neil.computer/404/
feedurl: https://neil.computer/rss/
enclosure_url: https://static.ghost.org/v4.0.0/images/feature-image.jpg
content_mime_type: text/html
content:
<img src="https://static.ghost.org/v4.0.0/images/feature-image.jpg" alt="Coming soon"><p>This is Neil Panchal&apos;s Blog, a brand new site by Neil Panchal that&apos;s just getting started. Things will be up and running here shortly, but you can <a href="#/portal/">subscribe</a> in the meantime if you&apos;d like to stay up to date and receive emails when new content is published!</p>


guid: 66aafad22b234d0983de2971
title: How to Build a Minimal ZFS NAS without Synology, QNAP, TrueNAS
author: Neil Panchal
url: https://neil.computer/notes/how-to-setup-minimal-zfs-nas-without-truenas/
feedurl: https://neil.computer/rss/
enclosure_url: https://neil.computer/content/images/2024/08/CleanShot-2024-08-23-at-23.09.01@2x.png
content_mime_type: text/html
content:
<figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://neil.computer/content/images/2024/08/CleanShot-2024-08-23-at-23.09.01@2x-1.png" class="kg-image" alt="How to Build a Minimal ZFS NAS without Synology, QNAP, TrueNAS" loading="lazy" width="2000" height="747" srcset="https://neil.computer/content/images/size/w600/2024/08/CleanShot-2024-08-23-at-23.09.01@2x-1.png 600w, https://neil.computer/content/images/size/w1000/2024/08/CleanShot-2024-08-23-at-23.09.01@2x-1.png 1000w, https://neil.computer/content/images/size/w1600/2024/08/CleanShot-2024-08-23-at-23.09.01@2x-1.png 1600w, https://neil.computer/content/images/2024/08/CleanShot-2024-08-23-at-23.09.01@2x-1.png 2000w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">ZFS System by Oracle</span></figcaption></figure><img src="https://neil.computer/content/images/2024/08/CleanShot-2024-08-23-at-23.09.01@2x.png" alt="How to Build a Minimal ZFS NAS without Synology, QNAP, TrueNAS"><p>If you need a basic NAS and don&apos;t care about GUI features, it is suprisingly simple to set up a ZFS dataset and share it over the network using Samba.</p><h4 id="scope">Scope:</h4>
<!--kg-card-begin: html-->
<table class="table">
    <thead class="black bg-light-gray ba b--black">
    <tr>
        <th colspan="2">Scope &amp; Requirements</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>Raid Level</td>
        <td>RAIDZ1 (1 Drive Redundancy)</td>
    </tr>
    <tr>
        <td>Operating System</td>
        <td>Debian 12 Bookworm</td>
    </tr>
    <tr>
        <td>Encryption</td>
        <td>None</td>
    </tr>
    <tr>
        <td>ZFS Implementation</td>
        <td>OpenZFS, zfs-2.1.1</td>
    </tr>
    <tr>
        <td>CPU</td>
        <td>4 Cores, Xeon Server CPU can be had for cheap</td>
    </tr>
    <tr>
        <td>RAM</td>
        <td>ECC RDIMM RAM 16 GB</td>
    </tr>
    <tr>
        <td>Storage</td>
        <td>4x4TB NVMe SSD</td>
    </tr>
    <tr>
        <td>Backups</td>
        <td>Not covered, use <a href="https://github.com/wyager/zfs-backup?ref=neil.computer">ZFS Backup Scheduler</a></td>
    </tr>
    <tr>
        <td>Skills</td>
        <td>Basic familiarity with Linux</td>
    </tr>
    <tr>
        <td>Skill Level</td>
        <td>Beginner/Easy</td>
    </tr>
    </tbody>
</table>

<!--kg-card-end: html-->
<p></p><p>I am using this article to document it for future myself, feel free to adopt it for your needs. Problem with TrueNAS is that it is a full-featured, supposedly enterprise-grade, software suite. While it may be simple to set it up (I&apos;ve never tried), I just don&apos;t need any of the bells and whistles it offers. It&apos;s the mismatch between what I need and what it offers; not something inherently wrong with TrueNAS. There is also something to be said about a system you know everything about and not having to rely on yet another thing.</p><h2 id="zfss-best-feature-thats-never-explained-or-written-anywhere">ZFS&apos;s best feature that&apos;s never explained or written anywhere</h2><p>ZFS filesystem is self contained. If your OS is nuked suddently, simply take all disks to another machine or install a new OS, install <code>zfs</code>, run <code>zfs import</code> and get back your data. This freedom is underrated and not well understood. It is also not explained anywhere.</p><p>It&apos;s worth emphasizing: All configuration/details about ZFS is stored on the disks themselves. If you&apos;ve setup a RAIDZ2 (Raid 6) with 6 disks, they are self contained. Move them to a new machine with <code>zfs</code> tools installed, and simply run <code>zfs import</code>. Boom, they&apos;ll show up as RAIDZ2. This is an amazing feature that no matter what happens to the host OS, machine, etc; as long as the disks are not damaged, your data is fine.</p><h2 id="step-1-locate-and-organize-disks">Step 1. Locate and Organize Disks</h2><p>List all disks on a linux machine using <code>lsblk -d -o TRAN,NAME,TYPE,MODEL,SERIAL,SIZE</code> command.</p><pre><code>[root@sys ~]# lsblk -d -o TRAN,NAME,TYPE,MODEL,SERIAL,SIZE
TRAN   NAME     TYPE MODEL                        SERIAL           SIZE
       sda      disk Virtual disk                                   40G
nvme   nvme5n1  disk Samsung SSD 990 PRO 4TB      XXXXXXXXXXXXXXX  3.6T
nvme   nvme2n1  disk Samsung SSD 990 PRO 4TB      XXXXXXXXXXXXXXX  3.6T
nvme   nvme6n1  disk Samsung SSD 990 PRO 4TB      XXXXXXXXXXXXXXX  3.6T
nvme   nvme3n1  disk Samsung SSD 990 PRO 4TB      XXXXXXXXXXXXXXX  3.6T</code></pre><p>These are brand new NVMe drives from Samsung so they should be completely unallocated.</p><p>The disks are also mapped to an ID, running <code>ls -lh /dev/disk/by-id</code>:</p><pre><code>[root@sys ~]# ls -lh /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root 10 May 10 09:34 dm-name-rhel-root -&gt; ../../dm-0
lrwxrwxrwx. 1 root root 10 May 10 09:34 dm-name-rhel-swap -&gt; ../../dm-1
lrwxrwxrwx. 1 root root 10 May 10 09:34 lvm-pv-uuid-DGBpev-Na0C-tY20-YY6E-tpL3-epNA-8Ts3Y0 -&gt; ../../sda3
lrwxrwxrwx. 1 root root 13 May 10 09:34 nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX -&gt; ../../nvme2n1
lrwxrwxrwx. 1 root root 13 May 10 09:34 nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX -&gt; ../../nvme5n1
lrwxrwxrwx. 1 root root 13 May 10 09:34 nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX -&gt; ../../nvme3n1
lrwxrwxrwx. 1 root root 13 May 10 09:34 nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX -&gt; ../../nvme6n1</code></pre><p>Notice that they are symlinked to their disk names in <code>/dev/</code>.</p><p>We can create a <code>/etc/zfs/vdev_id.conf</code> that maps an alias to these IDs:</p><pre><code>[root@sys ~]# vim /etc/zfs/vdev_id.conf

# Add these lines in the vdev_id.conf file
alias nvme0 /dev/disk/by-id/nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX
alias nvme1 /dev/disk/by-id/nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX
alias nvme2 /dev/disk/by-id/nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX
alias nvme3 /dev/disk/by-id/nvme-Samsung_SSD_990_PRO_4TB_XXXXXXXXXXXXXXX</code></pre><p>Run <code>udevadm trigger</code> to set the alias (or you can reboot the machine). We can verify that the aliases have been mapped by running <code>ls -lh /dev/disk/by-vdev</code>:</p><pre><code>lrwxrwxrwx.  1 root root  13 May 10 10:28 nvme0 -&gt; ../../nvme2n1
lrwxrwxrwx.  1 root root  13 May 10 10:28 nvme1 -&gt; ../../nvme5n1
lrwxrwxrwx.  1 root root  13 May 10 10:28 nvme2 -&gt; ../../nvme3n1
lrwxrwxrwx.  1 root root  13 May 10 10:28 nvme3 -&gt; ../../nvme6n1</code></pre><p><a href="https://openzfs.github.io/openzfs-docs/man/v2.2/5/vdev_id.conf.5.html?ref=neil.computer">Alias mapping</a> is completely optional, you can if you&apos;d like use the full ID <code>/dev/disk/by-id/nvme-eui.002538414143c248</code> of the disk when creating the zpool as we will do in the next section. Using an alias makes it nice. However, please don&apos;t use <code>/dev/nvme1, /dev/nvme2, ...</code>  as the order is not guaranteed, especially if you mount a new drive to the system. Creating a <code>vdev_id.conf</code> ensures that the serial number of the drive is tied to the alias.</p><p>Remember when we discussed there is no configuration needed on the host OS? <code>/etc/zfs/vdev_id/conf</code> is not necessary and only used when creating a zpool for convenience. If your OS gets nuked, and you lose <code>vdev_id.conf</code>, it won&apos;t matter at all.</p><h2 id="step-2-create-zpool">Step 2. Create ZPOOL</h2><p>For this tutorial, I am creating a RAIDZ1 (RAID 5) zpool. That means 1 drive redundancy in-case of failure. It&apos;s up to you if you&apos;d like additional redundancy, RAIDZ2 (RAID 6) would certainly be more risilient.</p><p>First, we need to install zfs on the linux machine. Please refer to the <a href="https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html?ref=neil.computer">OpenZFS documentation on how to install it</a>. It&apos;s usually as straight forward as, in my case, <code>dnf install zfs</code> on RHEL 9.</p><p>I recommend setting the <code>ashift=12</code> option when creating the zpool as this is your last chance to do so. Most disks report 512kB sector size to OS due to backwards compatibility reasons, but large disks such as Samsung 990 Pro has a sector size of 4KB or even 8KB. <code>ashift=12</code> represents a sector size of 4KB which will substantially improve performance.</p><pre><code>[root@sys ~]# ls /dev/disk/by-vdev
nvme0 nvme1 nvme2 nvme3
[root@sys ~]# zpool create -o ashift=12 s16z1 raidz1 nvme0 nvme1 nvme2 nvme3
[root@sys ~]# zpool status s16z1
  pool: s16z1
 state: ONLINE
config:

	NAME        STATE     READ WRITE CKSUM
	s16z1       ONLINE       0     0     0
	  raidz1-0  ONLINE       0     0     0
	    nvme0   ONLINE       0     0     0
	    nvme1   ONLINE       0     0     0
	    nvme2   ONLINE       0     0     0
	    nvme3   ONLINE       0     0     0

errors: No known data errors
[root@sys ~]#</code></pre><p>Perfect! I chose <code>s16z1</code> as the name as it describes the size and type of raid. Most tutorials will use <code>tank</code> as the name, as it relates to <code>pool</code>. Corny, I reject this.</p><p>We&apos;re not done yet. <code>zpool</code> is a disk abstraction, and <code>zfs</code> is the file system. When we ran <code>zpool create</code>, it created a <code>zfs</code> file system with it. </p><p>List all properties of the zfs file system by running: <code>zfs get all s16z1</code>. To check whether our zpool is properly configured with <code>ashift=12</code>, we can run: </p><pre><code>[root@sys ~]# zdb | grep ashift

ashift: 12</code></pre><p>Before we share the system, configure compression (optionally) as well as the default mount point.</p><pre><code>[root@sys ~]# zfs set mountpoint=/mnt/s16z1 s16z1
[root@sys ~]# zfs set compression=lz4 s16z1</code></pre><p>Next, let&apos;s create a couple of zfs datasets under <code>s16z1</code> root dataset. We will share them using Samba in the next section.</p><pre><code>[root@sys ~]# zfs create s16z1/docs
[root@sys ~]# zfs create s16z1/backups</code></pre><p><code>docs</code> for documents, <code>backups</code> for time machine backup. You can create as many datasets as you&apos;d like. Try to keep them at the top level. If you&apos;re wondering what is the difference between just a regular filesystem folder and a dataset&#x2014;a zfs dataset is a way more than just a folder. You can manage zillion properties of a dataset, encrypt it, send and replicate a dataset, take snapshots, etc.&#x2014;essentially, the entire ZFS feature set. Therefore, it is a good idea to create individual datasets for large categories of your files. <code>docs</code> or <code>backups</code> is a good abstraction level for a dataset. If you want to send just <code>docs</code> to a another remote server as a backup, you can do that without sending the whole <code>s16z1</code> root dataset. </p><p>We will discuss sharing <code>s16z1/docs</code> as a general purpose share as well as ceating a proper Time Machine storage (for Apple systems) by sharing <code>s16z1/backups</code> with special properties.</p><h2 id="step-3-share-disk-on-the-network">Step 3. Share disk on the network</h2><p>We&apos;ll use Samba for this, and the type of file sharing system is orthogonal to ZFS. ZFS doesn&apos;t care as long as it is mounted on the host system. </p><p>Install Samba:</p><pre><code>[root@sys ~]# apt install samba</code></pre><p>Create a UNIX user specifically for samba, we&apos;ll call it <code>john</code>:</p><pre><code>[root@sys ~]# useradd -m john</code></pre><p>and create a UNIX password for <code>john</code>:</p><pre><code>[root@sys ~]# passwd john</code></pre><p>Next, associate the UNIX user <code>john</code> to Samba by creating a Samba password for <code>john</code> . This password will then be used by hosts connecting to the share as <code>SYS\john</code>.</p><pre><code>[root@sys ~]# smbpasswd -a john</code></pre><p><code>john</code> is also added to the Samba user group. You can verify <code>john</code> as a SMB user by running:</p><pre><code>[root@sys ~]# pdbedit -L -v john

Unix username:        john
NT username:
Account Flags:        [U          ]
User SID:             S-1-5-21-880039843-1994218806-4034623300-1001
Primary Group SID:    S-1-5-21-880039843-1994218806-4034623300-513
Full Name:            john
Home Directory:       \\SYS\john
HomeDir Drive:
Logon Script:
Profile Path:         \\SYS\john\profile
Domain:               SYS
Account desc:
Workstations:
Munged dial:
Logon time:           0
Logoff time:          Wed, 06 Feb 2036 08:06:39 MST
Kickoff time:         Wed, 06 Feb 2036 08:06:39 MST
Password last set:    Fri, 23 Aug 2024 23:46:08 MST
Password can change:  Fri, 23 Aug 2024 23:46:08 MST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</code></pre><p>To delete <code>john</code> SMB user, <code>pdbedit -x -u john</code></p><p>Now that the UNIX user and Samba user is setup, configuring Samba service is extremely straight forward.</p><p>Edit <code>/etc/samba/smb.conf</code> (delete everything and replace with the following):</p><pre><code>[docs]
   path = /mnt/s16z1/docs
   browseable = yes
   read only = no
   guest ok = no
   valid users = john
   create mask = 0755
[backups]
   path = /mnt/s16z1/backups
   read only = no
   guest ok = no
   inherit acls = yes
   spotlight = yes
   fruit:aapl = yes
   fruit:time machine = yes
   vfs objects = catia fruit streams_xattr
   valid users = john</code></pre><p>Test it out on macOS by mounting it with <code>cmd+K</code> in Finder app and using the following url format: <code>smb://10.0.0.6/docs</code> and <code>smb://10.0.0.6/backups</code> where <code>10.0.0.6</code> is the IP of the server sharing the SMB share.</p><p>To test it on Debian systems or similar, install <code>apt install smbclient</code> and run:</p><pre><code>[root@sys ~]#  smbclient -U john //10.0.0.6/docs -c &apos;ls&apos;</code></pre><p>Mount the <code>smb://10.0.0.6/backups</code> and it will show up as a Time Machine share on macOS. Once mounted, start Time Machine backups by adding the share to macOS &gt; Settings &gt; General &gt; Time Machine.</p><p>That&apos;s all for now. I plan to write another article expanding on the encryption and very powerful zfs dataset replication features.</p><p>Cover image credit to Oracle ZFS systems. God, it is beautiful: <a href="https://docs.oracle.com/cd/E78901_01/html/E78910/gqtmb.html?ref=neil.computer">https://docs.oracle.com/cd/E78901_01/html/E78910/gqtmb.html</a></p>


guid: /2024/01/09/the-most-important-math-exams-of-my-life
title: The math exams of my life
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/01/09/the-most-important-math-exams-of-my-life
feedurl: https://www.andreinc.net/feed.xml
base: /2024/01/09/the-most-important-math-exams-of-my-life
content_mime_type: text/html
content:
<h1 id="table-of-contents">Table of contents</h1>

<ul>
  <li><a href="#the-system-is-flawed">The system is flawed</a></li>
  <li><a href="#the-system-is-simple">The system is simple</a></li>
  <li><a href="#my-first-important-exam---capacitate-2001">My first important exam - Capacitate (2001)</a>
    <ul>
      <li><a href="#the-subjects">The subjects</a></li>
      <li><a href="#translation-into-english-solutions">Translation into English + Solutions</a>
        <ul>
          <li><a href="#first-part-partea-1">First Part (Partea 1)</a></li>
          <li><a href="#second-part-partea-2">Second Part (Partea 2)</a></li>
          <li><a href="#third-part-partea-3">Third Part (Partea 3)        </a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="#the-second-important-exam---bacalaureat-2005">The second important exam - <em>Bacalaureat</em> (2005)</a>
    <ul>
      <li><a href="#the-syllabus">The Syllabus</a></li>
      <li><a href="#the-exercises">The Exercises</a></li>
      <li><a href="#translation-into-english-to-solutions">Translation into English to Solutions</a>
        <ul>
          <li><a href="#subiectul-1">Subiectul 1</a></li>
          <li><a href="#subiectul-2">Subiectul 2</a></li>
          <li><a href="#subiectul-3">Subiectul 3</a></li>
          <li><a href="#subiectul-4">Subiectul 4</a></li>
        </ul>
      </li>
    </ul>
  </li>
  <li><a href="#the-third-exam---admiterea-la-politehnica-2005">The third exam - <em>Admiterea la Politehnica</em> (2005)</a>
    <ul>
      <li><a href="#the-subjects-1">The subjects</a></li>
      <li><a href="#the-translations-solutions">The translations + solutions</a></li>
    </ul>
  </li>
  <li><a href="#conclusions">Conclusions</a></li>
</ul>

<h1 id="the-system-is-flawed">The system is flawed</h1>

<p>The Romanian public education system, which, by the way, is free for everyone (Universities included), has its flaws. However, it is still one of the best in the world for making a handful of kids proficient in mathematics and sciences. It’s a system of contrasts. On the one hand, you have a bunch of <em>Elite Schools</em> and Universities that put a lot of emphasis on scientific education, and on the other hand, you have the “average” Public Schools creating kids that can barely read, do simple arithmetics, or understand a simple text. Every middle-class parent that cares about the education of its children wants to send their children to an <em>Elite Public School</em>. The average school is actually below average, and Private Schools don’t have the best reputation, are too expensive, or are not that popular. The term <em>Elite</em> is not formalised, but there are “unofficial” rankings about how good the school is.</p>

<p>Getting there is mainly a <a href="https://en.wikipedia.org/wiki/Meritocracy">meritocratic</a> process. The child (or adolescent) must pass a few exams, and if he/she is 10/10 (or 9.50/10) he/she will be accepted almost anywhere. If you are 8.5/10, you will still get to a decent school. Lower than that, not so good. This state of affairs is similar to all the countries from the <a href="https://en.wikipedia.org/wiki/Eastern_Bloc">Eastern Bloc</a>, not only Romania. So, if you speak with a Bulgarian, Hungarian, Polish, Ukrainian, or Russian person, they will tell you the same story.</p>

<p>This is the secret recipe for why Eastern and Central Europe is so well-represented at the <a href="https://en.wikipedia.org/wiki/International_Mathematical_Olympiad">International Math Olympiad</a>. Those <em>Elite Schools</em>, spread in every region of the country, try to create the next generation of <em>olimpici</em> (kids that go to the Olympiads). Those <em>Elite Schools</em> are almost always <em>Math oriented</em>. It’s practically a <em>cult</em> (without any negative connotation).</p>

<p>Let’s look at the following table of results for IMO:</p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/imo.png" alt="" /></p>

<p>If you take Russia and Ukraine aside, Romania, Bulgaria, Hungary, and Poland have less than 80 million citizens together, but have accounted for 261 Gold Medals through the years, more than China or USA, the World’s two Superpowers. Of course, most of those students (and the ones that don’t qualify to the International but are way above the world’s average) leave Romania (or Poland, Hungary, and Bulgaria) to more prosperous, more developed countries. So what’s with all the fuss? <em>Brain drain</em> is a sad reality few try to counter.</p>

<p>The way those schools create the next-gen <em>olimpic</em> is simple: you make the kids take 4-6 of Math a week (or more), you give extensive Math homework (tens or hundreds of exercises per week), you ask the student to come to special classes designed to prepare them for the Olympiad, and then you repeat the formula for 12 years. Not everyone can make it, and the competition is tight. There’s a flaw here: some kids are differently wired than others and like challenges, but the constant grind is not suitable for everyone. Our Educational system is flawed because it expects almost everyone to ace Math. For example, I had colleagues in my class who are now lawyers, doctors, or work in creative industries but finished the <em>Elite (Math) School</em> only because the education there was so much better. So yes, in Romania, there are lawyers who studied <a href="https://en.wikipedia.org/wiki/Riemann_sum">Riemann Sums</a>, and dentists who did prove Euler’s identity with <a href="https://en.wikipedia.org/wiki/Taylor_series">Taylor Series</a>. We did learn both concepts in high school, but those are not necessarily part of the standard curricula.</p>

<p>In the Romanian region where I was born (<a href="https://en.wikipedia.org/wiki/Oltenia">Oltenia</a>), the elite high schools were: <a href="https://en.wikipedia.org/wiki/Carol_I_National_College">Colegiul National Carol I</a>, <a href="https://en.wikipedia.org/wiki/Fra%C8%9Bii_Buze%C8%99ti_National_College">Colegiul National Fratii Buzesti</a>, and Colegiul National Elena-Cuza (but historically speaking, this one was focused on <a href="https://en.wikipedia.org/wiki/Humanities">Humanities</a>). I’ve picked CNC1, but the alternative would’ve been as good. I remember that one of the role models we had in our first year of high school was <a href="https://en.wikipedia.org/wiki/Mihai_P%C4%83tra%C8%99cu_(computer_scientist)">Mihai Patrascu</a> (he was 3-4 years older than us), but all the teachers told us how great he is/was as a student. He was great at Computer Science and had fantastic results in Math.</p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/carol1_c.jpg" alt="" height="75%" width="75%" /></p>

<p>In <a href="https://en.wikipedia.org/wiki/Bucharest">Bucharest</a>, you can probably find even better schools, as the competition between students is more fierce. Everyone knows about <a href="https://en.wikipedia.org/wiki/Gheorghe_Laz%C4%83r_National_College,_Bucharest">Colegiul National Gheorghe Lazar</a>, <a href="https://en.wikipedia.org/wiki/Saint_Sava_National_College">Colegiul National Sfantul Sava</a>, or <a href="https://en.wikipedia.org/wiki/Tudor_Vianu_National_College_of_Computer_Science">Colegiul National Tudor Vianu</a>, a school that only in the last decade had 30 gold medalists, 53 silver medalists and 36 bronze medalists in various international competitions (mainly Math, Physics and Informatics).</p>

<p>The (sub)cult(ure) of Mathematics in Eastern Europe is older than communism, and the results were always notable. Communists loved Mathematics a lot. It was one of the few occupations that could instantly reward you with a decent life. It didn’t require you <em>to scream</em> total allegiance to the Communist Party, and it allowed you <a href="https://adevarul.ro/stiri-interne/societate/povestea-unui-mare-poet-si-matematician-dependent-2251351.html">to have a few excentricities well tolerated by a dictatorial regime</a>. So people went for it. To put it like this, <a href="https://en.wikipedia.org/wiki/Nicolae_Ceau%C8%99escu">Nicolae Ceasusescu</a>’s daughter, <a href="https://en.wikipedia.org/wiki/Zoia_Ceau%C8%99escu">Zoia Ceausescu</a>, was an accomplished mathematician; even if her parents disagreed with her passion, eventually, they accepted this endeavor to be worthy of a <em>Communist Princess</em>. The regime did not inflate her skills in mathematics; for example, a well-regarded academician <a href="https://en.wikipedia.org/wiki/Solomon_Marcus">Solomon Marcus</a>, vouched for her talent in an interview long after communism fell and Zoia died. He had no incentive to lie about the subject; it was a free country.</p>

<p>As a fun fact, the current mayor of Bucharest, <a href="https://en.wikipedia.org/wiki/Nicu%C8%99or_Dan">Nicusor Dan</a> is a two-time Gold Medalist at the International Mathematics Olympiad. He had a perfect score each time.</p>

<hr />

<h1 id="the-system-is-simple">The system is simple</h1>

<p>The Romanian education system is simple and shows little flexibility. It doesn’t care about too much about the children’s talents</p>

<p>You cannot take “extra classes”, and the first eight years of school are standard for everyone regardless of their skills and aptitudes:</p>

<ul>
  <li>The first cycle is called <em>Scoala Primara</em> (Primary school). <em>Scoala Primara</em> is about four years (or five) years long. You start school when you are 6, 7, or 8. I started school at 6 (in 1993), but most people send their kids to school at around 7.</li>
  <li>The second cycle, <em>Scoala Generala</em>, takes four years and starts when you are around 11-12. In recent times, if you want to attend an <em>Elite School</em>, you must pass an admission exam. The exam is not standard, and the <em>Elite Schools</em> decide the curricula. Sometimes, the <em>curricula</em> contain topics not part of the <em>formal curricula</em>, so the aspiring kid has to take private tutoring to prepare for this exam.</li>
  <li>At the end of the <em>Scoala Generala</em>, you must pass another exam called <em>Capacitate</em> (in my time) or <em>Teste Nationale</em> (in recent times). This exam is the first important one. If you are close to 10/10, you will be admitted to the <em>Elite School</em>; anything under 9/10 makes it more difficult or impossible. The admission process is totally transparent. You cannot bribe your way into admission, or at least not in this phase of the process.</li>
  <li>The third cycle is <em>Liceul</em>. This is where diversification first appears. You can go to a <em>Profil Real</em> to study <em>matematica-informatica</em> or a <em>Profil Uman</em>, to study <em>Humanities</em>. If you pick <em>Profil Uman</em>, it means your mathematical education stops. Usually, the best pick is <em>matematica-informatica</em>, which can also be spiced up with additional hours of math, physics, or informatics (basically Computer Science).</li>
  <li>At the end of high school, there’s a second exam called Baccaluareat (like in France). Getting a big mark at Baccalaureat helps you get admitted to local Universities, but there’s also an admission exam for the really good ones.</li>
</ul>

<hr />

<h1 id="my-first-important-exam---capacitate-2001">My first important exam - Capacitate (2001)</h1>

<p>It was 2001, and the first important Math exam I had to take was called <em>Capacitate</em>. I was 13 or 14 years old. Thanks to the internet, I did find the subjects online, so I had to solve them almost 23 years apart.</p>

<p>The exam was tailored to make it easy to get a mark higher than 7/10 and significantly more challenging to get a mark higher than 9/10.</p>

<p>Anything better than 9/10 would help you land a place in an <em>Elite</em> school. This was the target, so I aimed to get a perfect score (I was close: 9.80/10, if I remember correctly). Since I was ten years old, I have also participated in Math Olympiads, always making it into the top 25 students of my region (my best was 4th rank), so I remember <em>Capacitate</em> to be manageable.</p>

<p>In <em>Scoala Generala</em> I remember a lot of emphasis was put on basic Algebra and Geometry (2d and 3d). The student had to develop the <em>graphical</em> intuition of things.</p>

<h2 id="the-subjects">The subjects</h2>

<p>The subjects for the <em>Capacitate</em> were the following. We had two hours to solve them:</p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/capacitate.png" alt="" /></p>

<h2 id="translation-into-english--solutions">Translation into English + Solutions</h2>

<h3 id="first-part-partea-1">First Part (Partea 1)</h3>

<ol>
  <li>The result of \(5*6-7*4\) is: <code class="language-plaintext highlighter-rouge">...</code>
    <ul>
      <li>The obvious answer is \(30-28=2\).</li>
    </ul>
  </li>
  <li>Between \(6548\) and \(2145\), the number divisible by 3 is <code class="language-plaintext highlighter-rouge">...</code>
    <ul>
      <li>The rule is simple: for a number to be divisible by 3 the sum of its digits is divisible by 3, so the answer is: \(2145\). (\(2+1+4+5=12\), \(12\) is divisible by \(3\)).</li>
      <li>To solve this exercise, there’s no need to perform the division.</li>
    </ul>
  </li>
  <li>The arithmetic mean of the numbers \(18\) and \(12\) is <code class="language-plaintext highlighter-rouge">...</code>
    <ul>
      <li>This exercise simply asses if the kid understands the concept of an arithmetic mean, the answer is \(15\).</li>
    </ul>
  </li>
  <li>Given the <em>proportion</em> \(\frac{x}{6}=\frac{3}{2}\), \(x\) is <code class="language-plaintext highlighter-rouge">...</code>
    <ul>
      <li>\(x\) is \(\frac{6*3}{2}=9\).</li>
    </ul>
  </li>
  <li>Between \(a=5\sqrt{2}\) and \(b=2\sqrt{13}\) which one is bigger ?
    <ul>
      <li>The answer is \(2\sqrt{13}\). Back in school, I had to remember a few radicals to use them as needed. \(\sqrt{13}\) was one of them. I have forgotten them by now. We also had to learn the algorithm to compute any \(\sqrt{}\) as needed.</li>
    </ul>
  </li>
  <li>An isosceles triangle \(\text{ABC}\) with \([AC]\equiv[AC]\) has the angle \(\measuredangle \text{ABC}=35^{\circ}\), what is \(\measuredangle \text{BAC}=\) <code class="language-plaintext highlighter-rouge">...</code> ?
    <ul>
      <li>The sum of the angles in a triangle is \(180^{\circ}\), and we know that in an isosceles triangle the two angles \(\measuredangle \text{ABC}\) and \(\measuredangle \text{ACB}\) are equal. So the answer is \(\measuredangle \text{BAC}=180^{\circ}-2*35^{\circ}=110^{\circ}\).</li>
    </ul>
  </li>
  <li>A rhombus has the diagonals \(10\) and \(24\)?
    <ul>
      <li>What is the length of one of its sides?
        <ul>
          <li>The side is \(\sqrt{(\frac{10}{2})^{2}+(\frac{24}{2})^{2}}=13\)</li>
        </ul>
      </li>
      <li>What is the perimeter of the rhombus?
        <ul>
          <li>Now that we know one side, we multiply its value by \(4*13=52\).</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>A square prism has it’s volume \(80cm^3\), and the height \(5cm^2\)
    <ul>
      <li>The base surface of the prism is <code class="language-plaintext highlighter-rouge">...</code>
        <ul>
          <li>Applying the formula, we get the answer \(16cm^2\)</li>
        </ul>
      </li>
      <li>The side of the prim’s base is <code class="language-plaintext highlighter-rouge">...</code>
        <ul>
          <li>Applying the formula, we get  \(4cm^2\)</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>A cube has one of its sides \(2cm\). The total area of the cube is <code class="language-plaintext highlighter-rouge">...</code>
    <ul>
      <li>The answer is \(24cm^2\)</li>
    </ul>
  </li>
</ol>

<h3 id="second-part-partea-2">Second Part (Partea 2)</h3>

<ol>
  <li>A specific product had a price increase of 10%. After a while, it got a new 10% price increase, and it now costs \(133100 \text{lei}\).
    <ul>
      <li>What was the initial price of the product?
        <ul>
          <li>\(x\) is the initial price of the product;</li>
          <li>\(a=x+\frac{10x}{100}\) is the price of the product after then first 10 percent increase;</li>
          <li>After the second price increase \(a+\frac{10a}{100}=133100\);</li>
          <li>We compute \(a=133100*\frac{100}{110}=121000\);</li>
          <li>We compute \(x=121000*\frac{100}{110}=110000\).</li>
        </ul>
      </li>
      <li>What is the total price increase in percentages?
        <ul>
          <li>We need to solve this equation \(110000+110000\frac{x}{100}=133100\);</li>
          <li>We determine the total price increase to be \(\frac{21}{100}=21\)%;</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Considering the following functions \(f : \mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=ax+b-9\) and \(g : \mathbb{R} \rightarrow \mathbb{R}\), \(g(x)=2bx-a\) and \(a,b \in \mathbb{R}\):
    <ul>
      <li>Determine \(a,b\) knowing that \(A(2,3)\) belongs to \(f(x)\) and \(g(x)\);
        <ul>
          <li>If \(A(2,3)\) belongs to the \(f(x)\) and \(g(x)\), then the following is true: \(f(2)=a*2+b-9=3\) and \(g(2)=4b-a=3\).</li>
          <li>After solving the system of equations \(a=5\) and \(b=2\).</li>
        </ul>
      </li>
      <li>For \(a=5\) and \(b=2\) plot \(f(x)\) and \(g(x)\).
        <ul>
          <li>Substituting the values, we get the functions: \(f(x)=5*x+2-9=5*x-7\) and \(g(x)=4*x-5\)</li>
          <li>To plot them, we need to understand where the functions intersects \(OX\) and \(OY\).
            <ul>
              <li>\(f(0)=-7\) so the \(OY\) axis is intersected by \(f(x)\) at \((0, -7)\);</li>
              <li>\(5x-7=0\), we get \(x=\frac{7}{5}\), so the \(OX\) axis is intersected at \((\frac{7}{5}, 0)\);</li>
              <li>\(g(0)=-5\), so the \(OY\) axis is intersected by \(g(x)\) at \((0, -5)\);</li>
              <li>\(4x-5=0\), we get \(x=\frac{5}{4}\), so the \(OY\) axis is intersected at \((\frac{5}{4}, 0)\);</li>
              <li>We plot</li>
            </ul>
          </li>
        </ul>
      </li>
      <li>For \(a=5\) and \(b=2\), \(f\) intersects \(OY\) in \(B\), and \(g\) intersects \(OY\) in \(C\). Compute the distances from \(C\) to \(AB\).
        <ul>
          <li>We know that \(A\) is on \(f(x)\) and so is \(B\). So we can safely assume that the line equation for \(AB\) is the given by \(f(x)\), so \(y-5x+7=0\).</li>
          <li>A student can also compute the line equation from two points \(A\) and \(B\) with the formula: \(\frac{x-x_A}{x_B-x_A}=\frac{y-y_A}{y_B-y_A}\), but it’s a little bit overkill.</li>
          <li>We have to compute the distance from \(C(0,-5)\) to \(y-5x+7=0\) or \(-5x+y+7=0\).</li>
          <li>There’s a formula for that, \(d(ax+by+c, P(x_p, y_p))=\frac{\vert ax_p+by_p+c \vert}{\sqrt{a^2+b^2}}\).</li>
          <li>Substituting the values in the formula \(d=\frac{\vert (-5)*(0) + 1 * (-5) + 7 \vert}{\sqrt{(-5)^2 + 1^2}}=\frac{2}{25+1}=\frac{\sqrt{26}}{13}\)</li>
        </ul>
      </li>
    </ul>
  </li>
</ol>

<h3 id="third-part-partea-3">Third Part (Partea 3)</h3>

<ul>
  <li>Plot the Frustum of a Right Circular Cone. The volume is \(312\pi \text{cm}^3\), and it’s height is \(8\text{cm}\). We section the frustum with a plane parallel to its base; this plane is going straight through the middle of its height. The surface of this section is \(36\pi \text{cm}^2\).</li>
  <li>The radius of the smaller base of the frustum is \(r\). Prove that \(r^2 - 12*r + 27=0\).
    <ul>
      <li>The vormula for the Volume is \(V=\frac{1}{3}h\pi (R^2 + r^2 + Rr)\).</li>
      <li>If we substitute the values, we obtain \(R^2+r^2+Rr=117\). <code class="language-plaintext highlighter-rouge">(1)</code></li>
      <li>If the surface of the section is \(S_{s}=36\pi=\pi*{r_s}^2\), the radius of the section is \(r_s=\sqrt{36}=6\).</li>
      <li>But, \(\frac{R+r}{2}=r_s\), so we can say that \(R+r=12\). <code class="language-plaintext highlighter-rouge">(2)</code></li>
      <li>Using <code class="language-plaintext highlighter-rouge">(1)</code> in <code class="language-plaintext highlighter-rouge">(2)</code>, we obtain \(R^2+r(R+r)=(12-r)^2 + r*12=117\). After a few more steps we prove that \(r^2-12r+27=0\).</li>
    </ul>
  </li>
  <li>Determine the radiuses of the two bases of the frustum.
    <ul>
      <li>We already know the relationship: \(r^2-12r+27=0\) holds true, so we can compute the radiuses as \(3\) and \(9\).</li>
    </ul>
  </li>
  <li>If the radiuses are \(9\) and \(3\), compute the sector of the arc, which is the lateral unfolding of the frustum.
    <ul>
      <li>There’s a formula for this \(A_l = \pi G(R+r)\), and \(G=\sqrt{h^2+(R-r)^2}=10\). So \(A_l=120\pi \text{cm}^2\).</li>
    </ul>
  </li>
</ul>

<hr />

<h1 id="the-second-important-exam---bacalaureat-2005">The second important exam - <em>Bacalaureat</em> (2005)</h1>

<p>Just like <em>Capacitate</em>, <em>Bacalaureat</em> is tailored in a way you can pass it (the minimum requirement is 5/10), but it makes it harder to score 10/10. Again, I couldn’t score 10/10, but 9.90/10 was close.</p>

<p>In Romania, if you opt for a <em>matematica-informatica</em> specialization, you study pieces of everything: some advanced algebra, basic statistics, linear algebra, descriptive geometry, and lots of real analysis.</p>

<h2 id="the-syllabus">The syllabus</h2>

<p>The high school math syllabus is quite intense, or at least this is how I’ve felt it to be. I had to allocate lots of extra time to grasp the concepts my brilliant teacher constantly threw at me (thanks, Mrs. Georgescu, you were great!).</p>

<p>On the one hand, I am grateful I did a lot of calculus in high school; it helped me with math and physics courses during my University years; on the other hand, I feel that making calculus mandatory for the Baccalaureat punishes too harshly the students who are not mathematically inclined.</p>

<p>The following paragraphs contain a rough translation of the High-School Math Syllabyus (the version from <a href="https://www.mateinfo.ro/matematica-profesori-documente-titularizare-grade-definitivat/documente-scolare-matematica/programe-scolare-metodologii-programe-matematica-gimnaziu-si-liceu/377-programa-bac-matematica-m1-m2-m3-2016/fil">2017</a>) for the <em>matematica-informatica</em> specialization:</p>

<ol>
  <li><strong>Sets and Elements of Mathematical Logic</strong> (First Year)
    <ol>
      <li>Set of real numbers: algebraic operations with real numbers, ordering of real numbers, absolute value of a real number, approximations by deficiency or by excess, integer part, fractional part of a real number; operations with intervals of real numbers.</li>
      <li>Proposition, predicate, quantifiers</li>
      <li>Basic logical operations (negation, conjunction, disjunction, implication, equivalence), correlated with operations and relations between sets (complement, intersection, union, inclusion, equality); reasoning by <em>reductio ad absurdum</em>.</li>
      <li>Mathematical induction</li>
    </ol>
  </li>
  <li><strong>Sequences</strong> (First Year)
    <ol>
      <li>Ways to define a sequence, bounded sequences, monotonic sequences</li>
      <li>Specific sequences: arithmetic progressions, geometric progressions, the formula for the general term in terms of a given term and ratio, the sum of the first n terms of a progression</li>
      <li>Conditions for n numbers to form an arithmetic or geometric progression</li>
    </ol>
  </li>
  <li><strong>Functions; Graphical Readings/Representation</strong> (First Year)
    <ol>
      <li>Cartesian reference system, Cartesian product; representation through points of a Cartesian product of numerical sets; algebraic conditions for points located in quadrants; lines in the plane of the form \(x=m\), or \(y=m\) with \(m \in \mathbb{R}\).</li>
      <li>Function: definition, examples, examples of correspondences that are not functions, ways to describe a function, graphical readings. Equality of two functions, the image of a set through a function, the graph of a function, restrictions of a function;</li>
      <li>Numerical functions \((F={f:D \rightarrow \mathbb{R}, D \subseteq \mathbb{R}})\); geometric representation of the graph: intersection with the coordinate axes, graphical solutions of equations and inequalities of the form \(f(x)=g(x), (\gt, \lt, \geq, \leq)\); properties of numerical functions introduced through graphical reading: boundedness, monotonicity; other properties: parity/oddity, symmetry of the graph with respect to lines of the form \(x=m\), \(m \in \mathbb{R}\), periodicity;</li>
      <li>Function composition</li>
    </ol>
  </li>
  <li><strong>First-Degree Function</strong> (First Year)
    <ol>
      <li>Definition; graphical representation of the function: \(f:\mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=ax+b\), where \(a, b \in \mathbb{R}\)</li>
      <li>Intersection of the graph with the coordinate axes</li>
      <li>Graphical interpretation of the algebraic properties of the function: monotonicity and the sign of the function; studying monotonicity through the sign of the difference \(f(x_{1})-f(x_{2})\) (or by studying the sign of the ratio: \(\frac{f(x_1)-f(x_2)}{x_{1}-x_{2}})\), \(x_1, x_2 \in \mathbb{R}, x_1 \neq x_2\).</li>
      <li>Inequalities of the form \(ax+b (\gt, \lt, \geq, \leq) 0\) studied on or over intervals of real numbers.</li>
      <li>Systems of first-degree inequalities</li>
    </ol>
  </li>
  <li><strong>Second-Degree Function</strong> (First Year)
    <ol>
      <li>Graphical representation of the function: \(f:\mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=ax^2+bx+c\), \(a,b,c \in \mathbb{R}, a \neq 0\),  intersection of the graph with the coordinate axes, equation \(f(x)=0\), symmetry with respect to lines of the form \(x=m\), \(m \in \mathbb{R}\)</li>
      <li>Viète’s relations</li>
    </ol>
  </li>
  <li><strong>Geometric Interpretation of the Algebraic Properties of the Second-Degree Function</strong> (First Year)
    <ol>
      <li>Monotony; studying monotony through the sign of the difference \(f(x_1)-f(x_2)\) or through the rate of increase/decrease: \(\frac{f(x_1)-f(x_2)}{x_1-x_2}\), extreme point, vertex of the parabola;</li>
      <li>Positioning of the parabola relative to the x-axis, the sign of the function, inequalities of the form \(ax^2+bx+c(\gt, \lt, \geq, \leq) 0\), \(a, b, c \in \mathbb{R}, a \neq 0\), on or over intervals of real numbers, geometric interpretation: images of intervals (projections of portions of a parabola onto the y-axis);</li>
      <li>Relative position of a line with respect to a parabola</li>
    </ol>
  </li>
  <li><strong>Vectors in the Plane</strong> (First Year)
    <ol>
      <li>Oriented segment, vectors, collinear vectors</li>
      <li>Vector operations: addition (triangle rule, parallelogram rule), properties of the addition operation; scalar multiplication, properties of scalar multiplication; collinearity condition, decomposition along two non-collinear vectors</li>
    </ol>
  </li>
  <li><strong>Collinearity, concurrency, parallelism - vector calculus in plane geometry</strong> (First Year)
    <ol>
      <li>Position vector of a point</li>
      <li>Position vector of the point that divides a segment in a given ratio, Thales’ theorem (conditions for parallelism)</li>
      <li>Position vector of the centroid of a triangle (concurrency of medians of a triangle)</li>
      <li>Menelaus’ theorem, Ceva’s theorem</li>
    </ol>
  </li>
  <li><strong>Elements of Trigonometry</strong> (First Year)
    <ol>
      <li>Trigonometric circle, definition of trigonometric functions;</li>
      <li>Reduction to the first quadrant; trigonometric formulas</li>
    </ol>
  </li>
  <li><strong>Applications of Trigonometry and the Scalar Product of Two Vectors in Plane Geometry</strong> (First Year)
    <ol>
      <li>Scalar product of two vectors: definition, properties. Applications: cosine theorem, conditions of perpendicularity, solution of right-angled triangles</li>
      <li>Vector and trigonometric applications in geometry: sine theorem, solution of arbitrary triangles</li>
      <li>Calculation of the radius of the inscribed and circumscribed circles in a triangle, calculation of lengths of important segments in a triangle, calculation of areas</li>
    </ol>
  </li>
  <li><strong>Sets of Numbers</strong> (Second Year)
    <ol>
      <li>Real numbers: properties of powers with rational, irrational, and real exponents of a positive non-zero number, rational approximations for real numbers</li>
      <li>\(n\)th root (\(n \in \mathbb{R}\)) of a number, properties of radicals;</li>
      <li>Notion of logarithm, properties of logarithms, calculations with logarithms, logarithmic operation</li>
      <li>Set of complex numbers in algebraic form, conjugate of a complex number, operations with complex numbers. Geometric interpretation of addition and subtraction operations of complex numbers and their multiplication by a real number</li>
      <li>Solving a quadratic equation with real coefficients. Quadratic equations</li>
    </ol>
  </li>
  <li><strong>Functions and Equations</strong> (Second Year)
    <ol>
      <li>Power function with a natural exponent: \(f:\mathbb{R} \rightarrow D\), \(f(x)=x^n\), \(n \in \mathbb{N}\), \(n \geq 2\)</li>
      <li>Radical function: \(f:\mathbb{R} \rightarrow D\), \(f(x)=(x)^{\frac{1}{n}}\), \(n \in \mathbb{N}\), \(n \geq 2\), \(D=[0, \infty)\), \(n\) even or odd;</li>
      <li>Exponential function: \(f:[0, \infty)\), \(f(x)=a^x\), \(a \ge 0\), \(a \neq 1\);</li>
      <li>Logarithmic function: \(f:[0, \infty]\), \(f(x)=log_{a}(x)\), \(a \ge 0\), \(a \neq 1\);</li>
      <li>Injectivity, surjectivity, bijectivity; invertible functions: definition, graphical properties, necessary and sufficient condition for a function to be invertible</li>
      <li>Direct and inverse trigonometric functions</li>
    </ol>
  </li>
  <li><strong>Counting Methods</strong> (Second Year)
    <ol>
      <li>Ordered finite sets. Number of functions \(f:A \rightarrow B\), where \(A, B\) are finite Sets;</li>
      <li>Permutations:
        <ul>
          <li>Number of ordered sets obtained by arranging a finite set with \(n\) elements</li>
          <li>Number of bijective functions \(f:A \rightarrow B\), where \(A,B\) are finite Sets;</li>
        </ul>
      </li>
      <li>Arrangements
        <ul>
          <li>Number of ordered subsets with k elements, \(k \leq n\), that can be formed with \(n\) elements of a finite Sets;</li>
          <li>Number of injective functions \(f:A \rightarrow B\), where \(A, B\) are finite Sets;</li>
        </ul>
      </li>
      <li>Combinations
        <ul>
          <li>Number of subsets with k elements, \(0 \leq k \leq n\), of a finite Sets with \(n\) elements. Properties: complementary combinations formula, number of all subsets of a set with \(n\) elements</li>
        </ul>
      </li>
      <li>Newton’s Binomial</li>
    </ol>
  </li>
  <li><strong>Financial Mathematics</strong> (Second Year)
    <ol>
      <li>Elements of financial calculations: percentages, interest, VAT</li>
      <li>Collection, classification, and processing of statistical data: statistical data, graphical representation of statistical data</li>
      <li>Interpretation of statistical data through position parameters: means, variance, deviations from the mean</li>
      <li>Equally likely random events, operations with events, probability of a compound event composed of equally likely events</li>
    </ol>
  </li>
  <li><strong>Geometry</strong> (Second Year)
    <ol>
      <li>Cartesian coordinate system in the plane, coordinates of a vector in the plane, coordinates of the sum of vectors, coordinates of the product between a vector and a real number, Cartesian coordinates of a point in the plane, distance between two points in the plane</li>
      <li>Equations of a line in the plane determined by a point and a given direction, and equations of a line determined by two distinct points</li>
      <li>Conditions for parallelism, conditions for the perpendicularity of two lines in the plane; calculation of distances and areas</li>
    </ol>
  </li>
  <li><strong>Matrices and Systems of Linear Equations</strong> (Third Year)
    <ol>
      <li>Matrices;</li>
      <li>Matrix operations: addition, multiplication, multiplication of a matrix by a scalar, properties;</li>
      <li>Determinants;</li>
      <li>Systems of Linear Equations;</li>
      <li>Invertible matrices for \(n \leq 4\);</li>
      <li>Matrix equations;</li>
      <li>Linear systems with at most 4 unknowns, Cramer’s systems, matrix rank</li>
      <li>Study of compatibility and solution of systems: Kronecker-Capelli property, Rouchè property, Gaussian method</li>
      <li>Applications: equation of a line determined by two distinct points, area of a triangle, and collinearity of three points in the plane</li>
    </ol>
  </li>
  <li><strong>Elements of Real Analysis</strong> (Third Year)
    <ol>
      <li>Elementary notions about sets of points on the real line: intervals, boundedness, neighborhoods, closed line, symbols ∞ and −∞</li>
      <li>Real functions of a real variable: polynomial function, rational function, power function, radical function, logarithmic function, exponential function, direct and inverse trigonometric functions</li>
      <li>Limit of a sequence using neighborhoods, convergent sequences</li>
      <li>Monotony, boundedness, limits; the squeeze theorem</li>
      <li>Weistrass Property</li>
      <li>The number \(e\)</li>
      <li>Limits in the form \(((1+u_n)^\frac{1}{u_n})\), \(u_n \rightarrow 0\), \(u_n \neq 0\), \(n \in N\);</li>
      <li>Operations with Sequences that have a Limit</li>
      <li>Limits of functions: graphical interpretation of the limit of a function at a point using neighborhoods, one-sided limits</li>
      <li>Calculation of limits for the studied functions; exceptional cases in the calculation of limits of functions</li>
      <li>Asymptotes of the graph of studied functions: vertical asymptotes, oblique asymptotes</li>
    </ol>
  </li>
  <li><strong>Function Continuity</strong> (Third Year)
    <ol>
      <li>Continuity of a function at a point in its domain, continuous functions, graphical interpretation of the continuity of a function, studying continuity at points on the real line for the studied functions, operations with continuous functions</li>
      <li>Darboux’s property, the sign of a function continuous on an interval of real numbers, studying the existence of solutions to equations in \(\mathbb{R}\);</li>
    </ol>
  </li>
  <li><strong>Differentiability</strong> (Third Year)
    <ol>
      <li>Tangent to a curve, derivative of a function at a point, differentiable functions, operations with differentiable functions, calculation of first and second-order derivatives for the studied functions</li>
      <li>Functions differentiable on an interval: extreme points of a function, Fermat’s theorem, Rolle’s theorem, Lagrange’s theorem and their geometric interpretation, the corollary of Lagrange’s theorem regarding the derivative of a function at a point</li>
      <li>The role of the first derivative in the study of functions: monotony of functions, extreme points</li>
      <li>The role of the second derivative in the study of functions: concavity, convexity, inflection points</li>
      <li>L’Hôpital’s rules</li>
    </ol>
  </li>
  <li><strong>Graphical Representation of Functions</strong> (Third Year)
    <ol>
      <li>Graphical representation of functions</li>
      <li>Graphical solution of equations, using the graphical representation of functions to determine the number of solutions to an equation</li>
      <li>Graphical representation of conics (circle, ellipse, hyperbola, parabola)</li>
    </ol>
  </li>
  <li><strong>Advanced Algebra</strong> (Third Year)
    <ol>
      <li>Groups
        <ul>
          <li>Internal composition law (algebraic operation), operation table, stable part</li>
          <li>Group, examples: numerical groups, matrix groups, permutation groups, additive group of residue classes modulo \(n\)</li>
          <li>Subgroup</li>
          <li>Finite group, operation table, order of an element</li>
          <li>Morphism, group isomorphism</li>
        </ul>
      </li>
      <li>Rings and Fields
        <ul>
          <li>Ring, examples: numerical rings (\(Z, Q, R, C\)), \(Z_{n}\), matrix rings, rings of real functions</li>
          <li>Field, examples: numerical fields (\(Q, R, C\)), p-primary</li>
          <li>Ring and field morphisms</li>
        </ul>
      </li>
      <li>Polynomial Rings with Coefficients in a Commutative Field (Q, R, C, \(Z_p\), p-primary)
        <ul>
          <li>Algebraic form of a polynomial, polynomial function, operations (addition, multiplication, scalar multiplication)</li>
          <li>Remainder theorem; polynomial division, division by \(X−a\), Horner’s scheme</li>
          <li>Polynomial divisibility, Bézout’s theorem; greatest common divisor and least common multiple of polynomials, factorization of polynomials into irreducible factors</li>
          <li>Roots of polynomials, Viète’s relations</li>
          <li>Solving algebraic equations with coefficients in (\(Z, Q, R, C\)), binomial equations, quadratic equations, reciprocal equations</li>
        </ul>
      </li>
    </ol>
  </li>
  <li><strong>Real Analysis</strong> (Fourth Year)
    <ul>
      <li>Antiderivatives of a function defined on an interval. Indefinite integral of a function, properties of the indefinite integral, linearity. Standard antiderivatives</li>
      <li>Definite Integral
        <ul>
          <li>Subdivisions of an interval \([a,b]\), norm of a subdivision, system of intermediate points, Riemann sums, geometric interpretation. Definition of the integrability of a function on an interval \([a,b]\);</li>
          <li>Properties of the definite integral: linearity, monotony, additivity with respect to the integration interval.</li>
          <li>Leibniz-Newton formula</li>
          <li>Integrability of continuous functions, mean value theorem, geometric interpretation, theorem of the existence of primitives for a continuous function</li>
          <li>Methods of calculating definite integrals: Integration by parts, integration by change of variable.</li>
          <li>Calculation of integrals of the form \(\int_{a}^{b} \frac{P(x)}{Q(x)} dx\), using the method of partial fraction decomposition.</li>
        </ul>
      </li>
    </ul>
  </li>
</ol>

<h2 id="the-exercises">The Exercises</h2>

<p>The <em>Bacalaureat</em> exercises I had to solve (in 3 hours) were the following:</p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/bac1.png" alt="" /></p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/bac2.png" alt="" /></p>

<h2 id="translation-into-english-to-solutions">Translation into English to Solutions</h2>

<h3 id="subiectul-1">Subiectul 1</h3>

<ol>
  <li>If \(f:\mathbb{R} \rightarrow \mathbb{R}\) is \(f(x)=x-3\), what is the value of the prouct \(f(1)*f(2)*...*f(7)\)?
    <ul>
      <li>f(3)=0, so the product is itself 0. No need for additional computations.</li>
    </ul>
  </li>
  <li>How many non-empty subsets of the set \(\mathbb{Z}_{3}\) have a sum of elements equal to 0̂?
    <ul>
      <li>\(\mathbb{Z}_{3}\) refers to the set of integers modulo 3.</li>
      <li>We will have to consider various combinations and check the condition.</li>
      <li>The subsets are \(\{0\}\), \(\{1,2\}\), and \(\mathbb{Z}_{3}\), so the final answer is 3.</li>
    </ul>
  </li>
  <li>If the function \(f:\mathbb{R} \rightarrow \mathbb{R}\) is \(f(x)=-x^4+2x\) what is the value of \((f \circ f)(1)\) ?
    <ul>
      <li>We start with the definition \((f \circ f)(x)=f(f(x))=-(-x^4+2x)^4 + 2(-x^4+2x)\)</li>
      <li>We substitue \(x=1\), \((f \circ f)(1)=-1+2=1\)</li>
    </ul>
  </li>
  <li>What is the probability that an element n from the set \(\{0, 1, 2, 3, 4\}\) satisfies the relationship \(2^n + 5^n = 3^n + 4^n\) ?
    <ul>
      <li>The relantionship is <em>satisfied</em> if \(n=0\) or \(n=1\), using the formula for probabilities, the answer is \(P=\frac{2}{5}\).</li>
    </ul>
  </li>
  <li>How many real solutions does the \(x^4=16\) equation have?
    <ul>
      <li>\((x^4)=(x^2)^2=4\), because \(x \in \mathbb{R}\), the real solutions are \(2\) and \(-2\), so the answer is 2.</li>
    </ul>
  </li>
</ol>

<p>Considering the function: \(f:\mathbb{R}\), \(f(x)=e^x+x+\frac{1}{2}\).</p>

<ol>
  <li>Compute \(f'(x)\).
    <ul>
      <li>We simply compute: \(f'(x)=(e^x+x+\frac{1}{2})' = e^x + 1\)</li>
    </ul>
  </li>
  <li>Compute \(\int_{0}^{1}f(x)dx\).
    <ul>
      <li>We simply compute: \(\int_{0}^{1}f(x)dx=\int_{0}^{1}(e^x+x+1)dx=(e^x+\frac{x^2}{2}+\frac{x}{2}) \Big\|_0^1=e\).</li>
    </ul>
  </li>
  <li>How is the function \(f\) over the set of real numbers: convex or concave?
    <ul>
      <li>We differentiate the function twice and check the conditions:
        <ul>
          <li>If \(f''(x) \geq 0\), then the function is convex</li>
          <li>If \(f''(x) \leq 0\), then the function is concave</li>
        </ul>
      </li>
      <li>We know \(f'(x)=e^x+1\), so we can easily compute \(f''(x)=e^x\).</li>
      <li>It’s a known fact that \(e^x \geq 0\) so the answer is: \(f\) is convex on \(\mathbb{R}\).</li>
    </ul>
  </li>
  <li>What is the limit: \(\lim_{x \to 1} \frac{f(x)-f(1)}{x-1}\) ?
    <ul>
      <li>Cheesy one. The definition of the derivative in \(a\) is: \(\lim_{x \to a} \frac{f(x)-f(a)}{x-a}\);</li>
      <li>We have to compute \(f'(1)=e^1+1=e+1\). The answer is \(e+1\).</li>
    </ul>
  </li>
  <li>What is the limit \(\lim_{x \to \infty} \frac{\sqrt{n}}{n}\) ?
    <ul>
      <li>We can do this simple trick: \(\lim_{n \to \infty} \frac{\sqrt{n}}{n}=\lim_{n \to \infty}\frac{\sqrt{n}}{\sqrt{n}*\sqrt{n}}=\frac{1}{\infty}=0\).</li>
    </ul>
  </li>
</ol>

<h3 id="subiectul-2">Subiectul 2</h3>

<ol>
  <li>What is the distance between the two points: \(A(1,3,5)\) and \(B(3,5,7)\)?
    <ul>
      <li>We compute the distance: \(d=\sqrt{(3-1)^2+(5-3)^2+(7-5)^2}=\sqrt{3*2^2}=2*\sqrt{3}\)</li>
    </ul>
  </li>
  <li>What is the radius of the circle: \(x^2+y^2=4\) ?
    <ul>
      <li>The answer is \(r=2\) (fundamental equation of the circle)</li>
    </ul>
  </li>
  <li>What is \(cos^2\pi + sin^2\pi\) ?
    <ul>
      <li>The answer is 1, as per the fundamental: \(sin^2x+cos^2x=1\).</li>
    </ul>
  </li>
  <li>What is the modulus of the complex number \(z=\frac{5+8*i}{8-5*i}\)?
    <ul>
      <li>We need to compute: \(\vert z \vert\).</li>
      <li>If \(z=a+b*i\), then \(\vert z \vert=\sqrt{a^2+b^2}\)</li>
      <li>We need to reduce our \(z\) to a form were it’s easy to identity \(a\) and \(b\)</li>
      <li>In this regard, we can write \(z=\frac{(5+8*i)(8+5*i)}{(8-5*i)(8+5*i)}\)</li>
      <li>After doing all the computations: \(z=i\), so \(\vert z \vert=1\)</li>
    </ul>
  </li>
  <li>What is the area of a triangle with its sides: \(3\), \(3\) and \(4\) ?
    <ul>
      <li>The elegant way of doing it is to apply Heron’s theorem: \(A=\sqrt{p(p-a)(p-b)(p-c)}\), where \(p=\frac{a+b+c}{2}\).</li>
      <li>The answer is \(A=\sqrt{5*2*2*1}=2*\sqrt{5}\).</li>
    </ul>
  </li>
  <li>What is the equation of the tangent line to the parabola \(y^2 = 2x\) passing through the point \(P(2, 2)\)?
    <ul>
      <li>Applying the equation, we get to the form: \(2*y=x+2\).</li>
    </ul>
  </li>
</ol>

<h3 id="subiectul-3">Subiectul 3</h3>

<p>Considering the matrices: \(I=\begin{pmatrix} 1 &amp; 0 \\ 0 &amp; 1 \end{pmatrix}\), \(O_{2}=\begin{pmatrix} 0 &amp; 0 \\ 0 &amp; 0 \end{pmatrix}\), \(J=\begin{pmatrix} 0 &amp; 1 \\ 0 &amp; 0 \end{pmatrix}\), \(K=\begin{pmatrix} 1 &amp; 0 \\ 0 &amp; 0 \end{pmatrix}\), a matrix \(M \in M_{2}(\mathbb{R})\) is <em>nilpotent</em>, if there is \(n \in \mathbb{N}^{*}\), so that \(M^n=O_2\).</p>

<ol>
  <li>Prove that \(O_2\) and \(J\) are nilpotent
    <ul>
      <li>\(O_2^n=O_2\), \(∀ n \in \mathbb{N}^{*}\), so we can pick an arbitrary \(n\), and the nilpotency condition is satisfied.</li>
      <li>For \(J\) we just compute \(J^2\), and it becomes evident that the nilpotency condition is satisfied for \(n=2\).</li>
    </ul>
  </li>
  <li>Show that the \(K\) matrix is neither inversible nor nilpotent.
    <ul>
      <li>For a matrix to be invertible, \(det(A) \neq 0\), but \(det(K)=0\), so \(K\) is not invertible;</li>
      <li>We can prove \(K^n=K\), \(∀ n \in \mathbb{N}^{*}\), but \(K \neq O_2\), so \(K\) is not nilpotent;</li>
    </ul>
  </li>
  <li>Prove that \(X \in M_2(\mathbb{R})\), \(X=\begin{pmatrix} p &amp; q \\ r &amp; s \end{pmatrix}\), satisfies the identity: \(X^2 - (p+s)X + (ps-rq)I_2=O_2\).
    <ul>
      <li>First step is to compute \(X^2\).</li>
      <li>In this regard: \(X^2=\begin{pmatrix} p^2 + qr &amp; pq + qs \\ rp + rs &amp; s^2 + qr\end{pmatrix}\);</li>
      <li>The second step is to compute \((p+s)X=\begin{pmatrix} (p+s)p &amp; (p+s)q \\ (p+s)r &amp; (p+s)s \end{pmatrix}\);</li>
      <li>And lastly, we need to compute \((ps-rq)I_2=\begin{pmatrix} (ps-qr) &amp; 0 \\ 0 &amp; (ps-qr)\end{pmatrix}\);</li>
      <li>Putting it all together, the relationship is verified: \(X^2 - (p+s)X + (ps-rq)I_2=O_2\).</li>
    </ul>
  </li>
  <li>Prove that if \(A=\begin{pmatrix} a &amp; b \\ c &amp; d \end{pmatrix} \in M_2(\mathbb{R})\) checks the relationship \(A^2=O_2\), then \(a+d=0\) and \(ad-bc=0\).
    <ul>
      <li>If we look closely: \(a+d\) is the <em>trace</em> of A \(tr(A)\);</li>
      <li>Again, \(ad-bc\) is actually the determinant of \(A\);</li>
      <li>Now, if \(A=O_2\), then both the trace and determinant are \(0\);</li>
      <li>If \(A \neq O_2\), the relationship proved at the previous point becomes \(A^2 - tr(A)*A + det(A)*I_2=O_2\).</li>
      <li>But \(A^2=O_2\), so the relationship becomes: \(tr(A)*A=det(A)*I_2\).</li>
      <li>If we multiply each side of the previous equality with \(A\), and remember that \(A^2=O_2\), we get to \(det(A)*A=0\). But because we’ve decided that \(A \neq O_2\), we know that \(det(A)=0\), then \(ad-bc=0\).</li>
      <li>Given that \(det(A)=0\) and \(A^2=O_2\), then \(\underbrace{A^2}_{0}-tr(A)*A + \underbrace{det(A)*I_2}_{0}=O_2\), then \(tr(A)*A=O_2\), then \(tr(A)=0\), then \(a+d=0\).</li>
    </ul>
  </li>
  <li>Prove that if \(B \in M_2({\mathbb{R}})\) is <em>nilpotent</em>, then \(B^2=O_2\).
    <ul>
      <li>If \(B\) is <em>nilpotent</em>, then a number \(n \in \mathbb{N}^{*}\) exists, such that \(B^{n}=O_2\);</li>
      <li>If \(B^n=O_2\), we can say the same about \((B^n)^2=O_2\).</li>
      <li>Given the previously proved relationship, we also know that \(tr(B^n)\) and \(det(B^n)\) are \(0\).</li>
      <li>As a known identity, \(det(M * N)=det(M)*det(N)\), \(∀ M, N \in M_m(\mathbb{C})\), so inductively we keep in mind the fact that \(det(M^k)=det(M)^k\);</li>
      <li>Now, let’s get back and find our \(n\). We introduce \(n_0\), \(n_0 \in \mathbb{N}^{*}\), the first \(n\) that satisfies the condition;</li>
      <li>We know that \(det(B^{n_0})=0\), and so \(det(B)^{n_0}=0\). The only possible way to satisfy that is if \(det(B)=0\).</li>
      <li>So the relationship proved at <code class="language-plaintext highlighter-rouge">3.</code> becomes \(B^2-tr(B)*B=0\). If we multiply each side with \(B^{n_0-2}\), we get \(B^n_0-tr(B)*B^{n_0-1}=O_2\).</li>
      <li>But we already said that \(B^{n_0}=O_2\), this means that \(tr(B)*B^{n_0-1}=0\) so \(tr(B)=0\)</li>
      <li>At this point, all the conditions are met, and we can safely say that \(B^2=O_2\);</li>
    </ul>
  </li>
  <li>Prove that \(I_2\) cannot be written as an infinite sum of nilpotent matrices;
    <ul>
      <li>Ad absurdum, we say that \(I_2=\sum_{k=1}^{n}*A_k\), where \(A_k\) is <em>nilpotent</em> and \(k \in [1, \infty)\).</li>
      <li>Because \(A_k\) is <em>nilpotent</em>, then \(A_k^2=O_2\) and \(tr(A)=0\) (see <code class="language-plaintext highlighter-rouge">4.</code>);</li>
      <li>Through induction we can prove that \(tr(\sum_{k=1}^{\infty}A_k)=\sum_{k=1}^{\infty} tr(A_k)\);</li>
      <li>If our supposition that \(I_2=\sum_{k=1}^{n}*A_k\) was correct, then \(tr(\sum_{k=1}^{\infty}A_k)=0\). But that would be incorrect because \(tr(I_2)=2\), so our supposition was proved to be false.</li>
    </ul>
  </li>
</ol>

<h3 id="subiectul-4">Subiectul 4</h3>

<ol>
  <li>Verify that \(\frac{1}{1-a}=1+a+...+a^n+\frac{a^{n+1}}{1-a}\), \(∀ n \in \mathbb{N}\) and \(∀ a \in \mathbb{R}-\{1\}\).
    <ul>
      <li>We observe that \(1, a, a^2, a^3, ... , a^n\) are the first \(n+1\) terms of a <em>geometric progression</em> that starts with \(1\) and has \(a\) as the ratio.</li>
      <li>Using the formula, \(1+a+a^2+...+a^n=\frac{1-a^{n+1}}{1-a}=\frac{1}{1-a} - \frac{a^{n+1}}{1-a}\).</li>
      <li>Thus, \(\frac{1}{1-a}=1+a+...+a^n+\frac{a^{n+1}}{1-a}\)</li>
    </ul>
  </li>
  <li>Prove the relationship \(\frac{1}{1+\sqrt{x}}=1-\sqrt{x}+(\sqrt{x})^2+...+(-1)^n(\sqrt{x})^n+(-1)^{n+1}\frac{(\sqrt{x})^{n+1}}{1+\sqrt{x}}\), \(∀ x \in [0,1], ∀ n \in \mathbb{N}\).
    <ul>
      <li>Just by looking at <code class="language-plaintext highlighter-rouge">1.</code> and <code class="language-plaintext highlighter-rouge">2.</code> we see a similar pattern.</li>
      <li>The solution is to substitute \(a=-\sqrt{x}\), and the required relationship is proven.</li>
    </ul>
  </li>
  <li>Prove that \(0 \leq \frac{(\sqrt{x})^{n+1}}{1+\sqrt{x}} \leq (\sqrt{x})^{n+1}\), \(∀ x \in [0,1], ∀ n \in \mathbb{N}\).
    <ul>
      <li>We prove the two equalities one by one.</li>
      <li>We know that \((\sqrt{x})^{n+1} \geq 0\);</li>
      <li>We also know that \(\sqrt{x}+1 \geq 0\).</li>
      <li>We can then conclude that the ratio is also positive \(\frac{(\sqrt{x})^1} \geq 0\).</li>
      <li>\(\sqrt{x}\) is also an increasing function for \(x\) in our domain, so that the second is true;</li>
    </ul>
  </li>
  <li>Prove that \(\lim_{n \rightarrow \infty}\int_{0}^{b}\frac{(\sqrt{x})^{n+1}}{\sqrt{x}+1}dx=0\), \(∀ \in [0,1]\).
    <ul>
      <li>We make use of the previously proven inequality so we can <em>squeeze</em> our integral like this: \(0 \leq \int_{0}^{b}\frac{(\sqrt{x})^{n+1}}{\sqrt{x}+1}dx \leq \int_{0}^{b}(\sqrt{x})^{n+1}dx\)</li>
      <li>We determine \(\int_{0}^{b} (\sqrt{x})^{n+1}dx=\int_{0}^{b}x^{\frac{n+1}{2}}dx=\frac{x^{\frac{n+1}{2}+1}}{\frac{n+3}{2}}\Big\|_0^b=\frac{2}{n+3}*b^{\frac{n+3}{2}}\)</li>
      <li>We now use this in the limit: \(\lim_{n \rightarrow \infty}\int_{0}^{b} (\sqrt{x})^{n+1}dx=\lim_{n \rightarrow \infty} \frac{2}{n+3}*b^{\frac{n+3}{2}}\)</li>
      <li>We can write the limit \(\lim_{n \rightarrow \infty} \frac{2}{n+3}*b^{\frac{n+3}{2}}=(\lim_{n \rightarrow \infty}\frac{2}{n+3})*(lim_{n \rightarrow \infty}b^{\frac{n+3}{2}}) = 0 * k = 0\), where \(k \in \{0,1\}\).</li>
      <li>At this point, it is squeezed between two \(0\)s, so we’ve proven the limit to be 0;</li>
    </ul>
  </li>
  <li>Compute the following integral: \(\int_{0}^{b}\frac{1}{1+\sqrt{x}}dx\), \(b &gt; 0\).
    <ul>
      <li>We the following substitution: \(y=1+\sqrt{x}\), so that \((1+\sqrt x)dx=dy\), or \(2*\sqrt{x}dy=dx\), or \(dx=(2y-1)dy\).</li>
      <li>If \(x=0\), then \(y=1\)</li>
      <li>If \(x=b\), then \(y=1+\sqrt{b}\)</li>
      <li>So \(\int_{0}^{b}\frac{1}{1+\sqrt{x}}dx = 2 * \int_{1}^{1+\sqrt{b}} \frac{y-1}{y}dy=2*\int_{0}^{1+\sqrt{b}}dy - \int_{1}^{1+\sqrt{b}}\frac{1}{y}dy\);</li>
      <li>After every computation is done, the result is: \(\int_{0}^{b}\frac{1}{1+\sqrt{x}}dx=2*(\sqrt{b}-ln(1+\sqrt{b}))\)</li>
    </ul>
  </li>
  <li>Prove that \(\lim_{n \rightarrow \infty} (x + \frac{(-1)^1x^{(\frac{1}{2}+1)}}{\frac{1}{2}+1} + \frac{(-1)^2x^{(\frac{2}{2}+1)}}{\frac{2}{2}+1} + ... + \frac{(-1)^nx^{(\frac{n}{2}+1)}}{\frac{n}{2}+1})=\int_{0}^{x}\frac{1}{1+\sqrt{t}}dt\), \(∀ x \in [0,1]\).
    <ul>
      <li>We start with the integral. We’ve already worked on it at <code class="language-plaintext highlighter-rouge">2.</code>.</li>
      <li>We change to \(t\), \(\int_{0}^{x}\frac{1}{1+\sqrt{t}}dt=\int_{0}^{x}(1-\sqrt{t}+(\sqrt{t})^2+...+(-1)^n(\sqrt{t})^n + (-1)^{n+1}\frac{(\sqrt{t})^{n+1}}{1+\sqrt{t}})dt\).</li>
      <li>This also can be written as a sum of two integrals: \(\int_{0}^{x}\frac{1}{1+\sqrt{t}}dt=\int_{0}^{x}(1-\sqrt{t}+(\sqrt{t})^2+...+(-1)^n(\sqrt{t})^n)dt+\int_{0}^{x}((-1)^{n+1}\frac{(\sqrt{t})^{n+1}}{1+\sqrt{t}})dt\)</li>
      <li>The relationship then becomes: \(\int_{0}^{x}\frac{1}{1+\sqrt{t}}dt=(x+\frac{(-1)*x^{\frac{1}{2}+1}}{\frac{1}{2}+1}+...+\frac{(-1)^{n}*x^{\frac{n}{2}+1}}{\frac{n}{2}+1})+(-1)^{n+1}\int_{0}^{x}\frac{(\sqrt{t})^{n+1}}{1+\sqrt{t}}dt\)</li>
      <li>We apply the limit on the last relationship:  \(lim_{n \rightarrow \infty}\int_{0}^{x}\frac{1}{1+\sqrt{t}}dt=\lim_{n \rightarrow \infty}(x+\frac{(-1)*x^{\frac{1}{2}+1}}{\frac{1}{2}+1}+...+\frac{(-1)^{n}*x^{\frac{n}{2}+1}}{\frac{n}{2}+1})+\underbrace{lim_{n \rightarrow \infty}((-1)^{n+1}\int_{0}^{x}\frac{(\sqrt{t})^{n+1}}{1+\sqrt{t}})dt}_{0}\)</li>
      <li>Our relationship is proved.</li>
    </ul>
  </li>
</ol>

<h1 id="the-third-exam---admiterea-la-politehnica-2005">The third exam - <em>Admiterea la Politehnica</em> (2005)</h1>

<p>A good Baccalaureat grade was insufficient to get admitted to the <a href="https://www.wikiwand.com/en/Politehnica_University_of_Bucharest">UPB</a>. You had to pass an additional admission exam. This one was a little harder than the <em>Bacaluareat</em>, but not impossible. The catch was not to make any mistakes. Any wrong answer could’ve been fatal.</p>

<p>On day one, you had to pass an exam composed of Algebra + Real Analysis, and on the second day, you had a Physics Exam where you were free to pick two areas. I’ve decided to pick <em>Classical Mechanics</em> and <em>Thermodynamics</em>.</p>

<p>In this section, I will cover only the Math part.</p>

<h2 id="the-subjects-1">The subjects</h2>

<p>You had two hours to solve the following:</p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/upb1.png" alt="" /></p>

<p><img src="/assets/images/2024-01-11-the-most-important-math-exams-of-my-life/upb2.png" alt="" /></p>

<h2 id="the-translations--solutions">The translations + solutions</h2>

<ol>
  <li>Determine \(m \in \mathbb{R}\) so that \(f:\mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=\begin{cases}x^2-2x+m &amp;, m \leq 1 \\ e^x-e &amp;, x \gt 1\end{cases}\) to be continuos on \(\mathbb{R}\):
    <ul>
      <li>Both \(x^2-2x+m\) and \(e^x-e\) are elementary functions, so we can say they are continuous on their intervals;</li>
      <li>So we need to see what’s happening when \(x=1\);</li>
      <li>We need to check the limits (from both sides) for \(f(x)\);</li>
      <li>The limit from the left: \(\lim_{x \rightarrow 1}f(x)=f(1)=m-1\)</li>
      <li>The limit from the right: \(\lim_{1 \leftarrow x}f(x)=f(1)=0\)</li>
      <li>The conclusion is simple \(m-1=0\), so \(m=1\)</li>
    </ul>
  </li>
  <li>Solve the following inequation: \(\sqrt{x} \lt 1\).
    <ul>
      <li>This is a simple one: \(x \in [0, 1)\)</li>
    </ul>
  </li>
  <li>What’s the value for the following expression: \(E=\frac{1}{\sqrt{2}+\sqrt{3}}+\frac{1}{\sqrt{3}-\sqrt{2}}\)?
    <ul>
      <li>The expression is equivalent to: \(E=\frac{\sqrt{3}-\sqrt{2}}{3-2}+\frac{\sqrt{3}+\sqrt{2}}{3-2}=2\sqrt{3}\)</li>
    </ul>
  </li>
  <li>Compute the limit \(\lim_{n \rightarrow \infty}(\sqrt{n^2+n}-\sqrt{n^2+1})\).
    <ul>
      <li>The limit is equivalent to: \(\lim_{n \rightarrow \infty}(\frac{n^2+n-n^2-1}{\sqrt{n^2+n}+\sqrt{n^2+1}})\);</li>
      <li>Then we do the following trick: \(\lim_{n \rightarrow \infty}(\frac{n(1-\frac{1}{n})}{n*(\sqrt{1+\frac{1}{n}}+\sqrt{1+\frac{1}{n^2}})})\)</li>
      <li>But \(\frac{1}{n} \rightarrow 0\) and \(\frac{1}{n^2} \rightarrow 0\) when \(n \rightarrow \infty\), so if we take that into the account the answer is \(\frac{1}{2}\).</li>
    </ul>
  </li>
  <li>Given the equation \(x^2-ax+4=0\), \(a \in \mathbb{R}\). \(x_1, x_2\) solutions to the equation verify \(x_1 + x_2=5\) if:
    <ul>
      <li>a) \(a=4\); b) \(a=0\); c) \(x_1=x_2\); d) \(a &lt;0\); e) \(a=5\); f) \(x1, x2 \not\in \mathbb{R}\)</li>
      <li>Well, \(x_1+x_2=a\), then the correct answer is \(a=5\)</li>
    </ul>
  </li>
  <li>The solutions for the equation \(9^x-4*3^x+3=0\) are?
    <ul>
      <li>We consider \(y=3^x\), so the equation in \(y\) becomes: \(y^2-4y+3=0\);</li>
      <li>Then, \(y^2-3y-y+3=0\), or \((y-3)(y-1)=0\), the solutions are \(y_1=3\) and \(y_2=1\);</li>
      <li>This means \(3^x=3^1\), the exponential is injective, we can safely say \(x_1=1\) one of the two solutions;</li>
      <li>It also means \(3^x=3^0\), so \(x_2=0\) is the other solution</li>
    </ul>
  </li>
  <li>Determine \(m, n \in \mathbb{R}\) so that the equation: \(x^4+3x^3+mx^2+nx-10=0\) to admit the solution \(x_1=i\):
    <ul>
      <li>We substitute \(x=i\), so the equation becomes: \(i^4+3i^3+mi^2+ni-10=0\)</li>
      <li>We obtain \((-m-9) + i(n-3)=0\), this is a complex number.</li>
      <li>\((-m-9)\) needs to be \(0\), \(n-3\) needs to be \(0\)</li>
      <li>The answer is \(m=-9\) and \(n=3\)</li>
    </ul>
  </li>
  <li>Compute the 10th term of the arithmetic progression starting with \(a_1=5\), with the \(r=2\).
    <ul>
      <li>Using the formula we get: \(a_10=a_1+(10-1)*r=23\)</li>
    </ul>
  </li>
  <li>Compute \(\int_{0}^{1}\frac{x^2}{x^3+1}dx\)
    <ul>
      <li>We write as: \(\int_{0}^{1}\frac{x^2}{x^3+1}dx=\frac{1}{3}\int_{0}^{1}\frac{3*x^2}{x^3+1}dx\)</li>
      <li>We observe the integral can further be written as: \(\frac{1}{3}\int_{0}^{1}\frac{(x^3+1)'}{x^3+1}dx\)</li>
      <li>This is a known form, the answer is: \(\frac{1}{3}ln(2)\)</li>
    </ul>
  </li>
  <li>If \((a,b)\) are a solution for the following system of equations: \(\begin{cases} x+y=2 \\ xy=1\end{cases}\), then:
    <ul>
      <li>a) \(a^2b^2=2\); b) \(a^2+b^2=2\); c) \(a^2+b^2=1\); d) \(a^2+b^2=3\); e) \(a^2 + b^2 &lt; 0\); f) \(a \neq b\)</li>
      <li>We simply solve the system, we see that \(a=1\), and \(b=1\), so the answer is \(a^2+b^2=1\)</li>
    </ul>
  </li>
  <li>Given \(f:\mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=\frac{x^2}{x^2+1}\). Compute \(f'(1)\):
    <ul>
      <li>We know \(f'(x)=\frac{2x(x^2+1)-x^2*2x}{(x^2+1)^2}\)</li>
      <li>We compute \(f'(1)=\frac{1}{2}\)</li>
    </ul>
  </li>
  <li>The following composition rule is defined on \(\mathbb{R}\): \(x * y = xy+2ax+by\). Determine the relationship between \(a\) and \(b\) so that the rule is commutative.
    <ul>
      <li>If the rule is commutative, then: \(xy+2ax+by=yx+2ay+bx\)</li>
      <li>After a few more steps: \(2a(x-y)-b(x-y)=0\), or \((x-y)(2a-b)=0\).</li>
      <li>The answer is: \(2a=b\) almost 20 years ago</li>
    </ul>
  </li>
  <li>What’s the minimum of the following function: \(f:\mathbb{R} \rightarrow \mathbb{R}\), \(f(x)=\sqrt{4x^2+28x+85}+\sqrt{4x^2-28x+113}\)?
    <ul>
      <li>This is pure grind, nothing exciting; the eventual answer will be: \(14\sqrt{2}\).</li>
    </ul>
  </li>
  <li>Given \(f:\mathbb{C} \rightarrow \mathbb{C}\), \(f(z)=z^2+z+1\), compute \(f(\frac{-1+i\sqrt{3}}{2})\)
    <ul>
      <li>We compute: \(f(\frac{-1+i\sqrt{3}}{2})=\frac{1-3-2*i\sqrt{3}}{4}+\frac{-2+2i\sqrt{3}}{4} + \frac{4}{4}\)</li>
      <li>The final answer is 0;</li>
    </ul>
  </li>
  <li>Solve the following equation: \(det(\begin{pmatrix} 2 &amp; x &amp; 0 \\ x &amp; -1 &amp; x \\ 2 &amp; -5 &amp; -4\end{pmatrix})=0\)
    <ul>
      <li>Computing the determinant, \(det=x^2-5x+4=0\), \(x=1\) or \(x=4\).</li>
    </ul>
  </li>
  <li>Compute the limit of \(a_n=\sum_{k=1}^{n}(\frac{k(k+1)}{2x^{k-1}})\), where \(\vert x \vert &gt; 1\)
    <ul>
      <li>After all the grind the result is: \(\frac{x^3}{(x-1)^3}\)</li>
    </ul>
  </li>
  <li>Given the function: \(f:[0, \infty)\), \(f(x)=\int_{x}^{x+1}\frac{t^2}{\sqrt{t^4+t^2+1}}dt\). Decide if:
    <ul>
      <li>a) f(0) = 0; b) f is odd; c) f is convex; d) f admits a horizontal asymptote; e) f has 2 extreme points f) f admits one oblique asymptote</li>
      <li>We start checking for the following conditions:
        <ul>
          <li>\(f(0)\) is false, f(x) is strictly \(&gt;0\);</li>
          <li>\(f(x)\) cannot be odd, given its domain;</li>
          <li>so both a) and b) are false;</li>
        </ul>
      </li>
      <li>We differentiate: \(f'(x)=\frac{(x+1)^2}{\sqrt{(x+1)^4 + (x+1)^2 + 1}} - \frac{x^2}{\sqrt{x^4+x^2+1}}=0\)</li>
      <li>After some grind, I am too lazy to write in Latex, we find out that there are no extreme points and and it doesn’t admit any horizontal asymptote</li>
      <li>The final result: \(f''(x)&gt;0\) the the function is convex;</li>
    </ul>
  </li>
  <li>Compute: \(\lim_{x \rightarrow 0}\frac{(x-1)^2-1}{x}\).
    <ul>
      <li>After applying L’Hopital the result is: \(-2\)</li>
    </ul>
  </li>
</ol>

<h1 id="conclusions">Conclusions</h1>

<p>Looking back at everything that was thrown at me 20 years ago, I have a few observations:</p>
<ul>
  <li>Most of the exercises lack imagination and are either purely theoretical, like the one with matrices from the <em>Bacalaureat</em> or extremely <em>grindy</em>;</li>
  <li>The exams were not complex, but you had to get perfect scores under difficult time constraints;</li>
  <li>The system works, but it lacks any direction.</li>
  <li>In a follow-up article, I plan to select some Olympiad questions I have had to solve through the years. Those are much more interesting and imaginative.</li>
</ul>

<p>That’s it. How were your exams?</p>


guid: /2024/02/06/the-sinusoidal-tetris
title: The sinusoidal tetris
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/02/06/the-sinusoidal-tetris
feedurl: https://www.andreinc.net/feed.xml
base: /2024/02/06/the-sinusoidal-tetris
content_mime_type: text/html
content:
<p>Let’s play Tetris, but with a twist. No geometrical figures will <em>fall from the sky</em>. Instead, you control a <a href="https://en.wikipedia.org/wiki/Sine_wave">sinusoid</a>, defined by: \(f(x)=A*sin(\omega x + \varphi)\):</p>

<hr />

<table>
  <tbody>
    <tr>
      <td><input type="checkbox" id="suggestions" name="suggestions" value="yes" checked="" /></td>
      <td>Free suggestions in the beginning. If you follow all of them, you win.</td>
    </tr>
    <tr>
      <td><input type="checkbox" id="turnBased" name="turnBased" value="no" /></td>
      <td>Turn-Based Mode (the sinusoid doesn’t drop automatically)</td>
    </tr>
  </tbody>
</table>

<div id="tetris-sketch"></div>
<p><sup><sup><a href="/assets/js/2024-02-06-the-sinusoidal-tetris/tetris.js">(Source code)</a></sup></sup></p>

<hr />

<p>Controls</p>
<ul>
  <li>To increase the angular frequency, \(\omega\), press: <code class="language-plaintext highlighter-rouge">s</code>;</li>
  <li>To decrease the angular frequency, \(\omega\), press: <code class="language-plaintext highlighter-rouge">x</code>;</li>
  <li>To increase the amplitude, \(A\), press: <code class="language-plaintext highlighter-rouge">a</code>;</li>
  <li>To decrease the amplitude, \(A\), press: <code class="language-plaintext highlighter-rouge">z</code>;</li>
  <li>To increase the phase: \(\varphi\), press: <code class="language-plaintext highlighter-rouge">q</code>;</li>
  <li>To decrease the phase: \(\varphi\), press: <code class="language-plaintext highlighter-rouge">w</code>;</li>
  <li>To <em>drop</em> the sinusoid, press <code class="language-plaintext highlighter-rouge">p</code>;</li>
</ul>

<hr />

<p>To win the game, you need to reduce the signal as close to zero as possible. It’s hard but not impossible. There’s a current threshold of <code class="language-plaintext highlighter-rouge">unit * 0.3</code>. Surviving is not winning. The <em>Path of the Alternating Phases</em> is boredom.</p>

<p>You lose if the original signal spikes outside the game buffer (canvas).</p>

<p>A professional player turns off the suggestions, now enabled by default. If you are a savant, you can compute the <a href="https://en.wikipedia.org/wiki/Fourier_series"><em>Fourier Series Coefficients</em></a> in your head. Cancel that noise!</p>

<p>To better understand what is happening, check out <a href="/2024/04/24/from-the-circle-to-epicycles">this first article of a series</a>.</p>

<hr />

<p>The game was developed using <a href="https://p5js.org/">p5js</a>.</p>

<p>The source code <a href="/assets/js/2024-02-06-the-sinusoidal-tetris/tetris.js">(here)</a> is not something I am particularly proud of.</p>

<hr />

<p>Some discussion from around the web:</p>

<ul>
  <li><a href="https://news.ycombinator.com/item?id=39275715">Hacker News</a></li>
  <li><a href="https://lobste.rs/s/h1y3ql/sinusoidal_tetris">Lobste.rs</a></li>
  <li><a href="https://museumofscreens.wordpress.com/2024/02/07/web-game-of-the-day-sinusoidal-tetris/">Museum Of Screens</a></li>
  <li><a href="khttps://hackaday.com/2024/02/07/tetris-goes-full-circle/#comments">hackaday - tetris goes full circle</a></li>
  <li><a href="https://www.microsiervos.com/archivo/juegos-y-diversion/tetris-sinusoidal-existe-encanto-matematicamente-especial.html">microsiervos</a></li>
</ul>

<hr />

<p><sup>This game is a joke I put together during a weekend. I’m sorry for the graphics.</sup></p>


guid: /2024/02/23/20-algebra-problems-part-1
title: 20 algebra problems selected from the Romanian Olympiad (Part 1)
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/02/23/20-algebra-problems-part-1
feedurl: https://www.andreinc.net/feed.xml
base: /2024/02/23/20-algebra-problems-part-1
content_mime_type: text/html
content:
<h1 id="introduction">Introduction</h1>

<blockquote>
  <p>This is a “follow-up” to the previous article: <a href="/2024/01/09/the-most-important-math-exams-of-my-life">“The math exams of my life”</a>, as some readers were curious to see some examples of Math Olympiad exercises.</p>
</blockquote>

<p>This a selection of <em>cute</em>, <em>non-trivial</em> algebra problems (with a hint of <em>number theory</em>) <em>compiled</em> from the Romanian Math Olympiad (regional phase or <em>faza judeteana</em>) for 8<sup>th</sup>, 9<sup>th</sup>, and 10<sup>th</sup> graders (13-15 years old).</p>

<p>The solutions are surprising and involve a good understanding of algebraic concepts, pattern spotting, or tricks that, in the long run, help students develop <a href="https://en.wikipedia.org/wiki/Logical_intuition#:~:text=Logical%20Intuition%2C%20or%20mathematical%20intuition,to%20solve%20mathematical%20challenges%20efficiently.">mathematical intuition</a>.</p>

<p>Depending on your passion for mathematics (or competitive mathematics), the problems should pose enough difficulty to keep you entertained for a few hours. If you are stuck with one problem, try to read the hint instead of going straight to the answer.</p>

<p>In case you want to solve them by yourself, do a short recap on the following subjects:</p>
<ul>
  <li><a href="https://en.wikipedia.org/wiki/Set_(mathematics)">Sets</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Sequence">Sequences of numbers</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Faulhaber%27s_formula">Faulhaber’s formula</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Rearrangement_inequality">Rearrangement inequality</a></li>
  <li><a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM Inequality</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">Cauchy–Bunyakovsky–Schwarz Inequality</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Hermite%27s_identity">Hermite’s Identity</a>;</li>
  <li><a href="https://en.wikipedia.org/wiki/Monotonic_function">Monotonic functions</a>.</li>
</ul>

<p>The main topic of this problem set is: “Inequalities”.</p>

<h1 id="additional-notes">Additional note(s)</h1>

<blockquote>
  <p>There’s a follow-up article - <a href="/2024/03/25/10-algebra-problems-part-2">here</a>.</p>
</blockquote>

<p>I have a few notebooks containing solutions for various Math problems I’ve solved over the years (recreational mathematics).  If time allows, I will publish more lists covering more topics. Currently, I am in the process of grouping them into categories.</p>

<p><img src="/assets/images/2024-03-10-23-algebra-problems-part-1/notebook.jpeg" alt="img" height="75%" width="75%" /></p>

<p><sup><sup>“Screenshot” from one my notebooks.</sup></sup></p>

<p>The problems are from the “Regional” Phase of the Romanian Math Olympiad. The truly difficult problems are usually the ones from the “National” phase. I am planning to publish a list of those as well.</p>

<p>Another important aspect is that I am not a <em>mathematician</em>, so if you see that solutions are incorrect or have better solutions, please send me some feedback.</p>

<h1 id="the-problems">The Problems</h1>

<hr />

<p><strong>1.</strong> <sup><sup>easy</sup></sup> Compute \(S=1-4+9-16+..+99^2-100^2\). <sup><sup><a href="#hint-1">Hint</a> &amp;  <a href="#answer-1">Answer</a></sup></sup></p>

<hr />

<p><strong>2.</strong> <sup><sup>easy</sup></sup> Determine the smallest element of the set  \(\{ab \text{ } \lvert \text{ } a,b \in \mathbb{R} \text{ and } a^2 + 2b^2=1\}\)? <sup><sup><a href="#hint-2">Hint</a> &amp;  <a href="#answer-2">Answer</a></sup></sup></p>

<hr />

<p><strong>3.</strong> <sup><sup>easy</sup></sup> What is the <a href="https://en.wikipedia.org/wiki/Cardinality">cardinality</a> of following set: \(\{x \in \mathbb{R} \lvert [\frac{x+1}{5}]=\{\frac{x-1}{2}\} \}\). \(\{ a \}\) is the <a href="https://mathworld.wolfram.com/FractionalPart.html">fractional part</a> of the number \(a \in \mathbb{R}\), and \([a]\) is the <a href="https://mathworld.wolfram.com/IntegerPart.html">integer part</a> of \(a \in \mathbb{R}\).  <sup><sup><a href="#hint-3">Hint</a> &amp;  <a href="#answer-3">Answer</a></sup></sup></p>

<hr />

<p><strong>4.</strong> <sup><sup>easy</sup></sup> Find all the elements of the set \(\{\frac{3}{2x} \lvert x \in \mathbb{R} \text{ and, } \frac{1}{[x]} + \frac{1}{\{x\}}=2x \}\). \(\{ a \}\) is the <a href="https://mathworld.wolfram.com/FractionalPart.html">fractional part</a> of the number \(a \in \mathbb{R}\), and \([a]\) is the <a href="https://mathworld.wolfram.com/IntegerPart.html">integer part</a> of \(a \in \mathbb{R}\).  <sup><sup><a href="#hint-1">Hint</a> &amp;  <a href="#answer-1">Answer</a></sup></sup></p>

<hr />

<p><strong>5.</strong> <sup><sup>easy</sup></sup> Given \(a,b,c \in \mathbb{R}^{*}\), we know that \((a,b,c)\) are part of an <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">arithmetic progression</a>, \((ab, bc, ca)\) are part a <a href="https://en.wikipedia.org/wiki/Geometric_progression">geometric progression</a>, and \(a+b+c=ab+bc+ca\). The triplets in the set \(M=\{(a,b,c)\ \lvert a,b,c \in \mathbb{R}^{*}\}\) satisfy all the conditions mentioned before.</p>

<p>Compute \(\sum_{(a,b,c) \in M} (\lvert a \rvert + \lvert b \rvert + \lvert c \rvert)\).  <sup><sup><a href="#hint-5">Hint</a> &amp;  <a href="#answer-5">Answer</a></sup></sup></p>

<hr />

<p><strong>6.</strong> <sup><sup>easy</sup></sup> For the following sequence of numbers \((a_n)_{n \ge 1}\), \(a_1=1\) and \(a_2=6\) and \(a_{n+1}=\frac{a_n}{a_{n-1}}\), \(n \ge 2\), compute \(a_{2021}\).  <sup><sup><a href="#hint-6">Hint</a> &amp;  <a href="#answer-6">Answer</a></sup></sup></p>

<hr />

<p><strong>7.</strong> <sup><sup>medium</sup></sup> Find all numbers \(k \in \mathbb{Z}\), so that \(a^4+b^4+c^4+d^4+k*abcd \ge 0\), \(\forall a,b,c,d \in \mathbb{R}^{*}\).  <sup><sup><a href="#hint-7">Hint</a> &amp;  <a href="#answer-7">Answer</a></sup></sup></p>

<hr />

<p><strong>8.</strong>  <sup><sup>medium</sup></sup> If \(x,y,z,t \in \mathbb{R}\), and \((x-3y+6z-t)^2 \ge 2021\) and \(x^2+y^2+z^2+t^2 \le 43\), then what is the value of the expression:  \(\lvert x + y + z + t \rvert\) ?  <sup><sup><a href="#hint-8">Hint</a> &amp;  <a href="#answer-8">Answer</a></sup></sup></p>

<hr />

<p><strong>9.</strong> <sup><sup>medium</sup></sup> Considering \(x^2 + (a+b+c)x + k(ab+bc+ca) = 0\)  where \(a,b,c \in \mathbb{R}_{+}^{*} \text{, and } k \in \mathbb{R}\) prove that \(\forall k \le \frac{3}{4}\) the equation has all its solution in \(\mathbb{R}\). <sup><sup><a href="#hint-9">Hint</a> &amp;  <a href="#answer-9">Answer</a></sup></sup></p>

<hr />

<p><strong>10.</strong> <sup><sup>easy</sup></sup> Prove that \([\frac{x+3}{6}] - [\frac{x+4}{6}] + [\frac{x+5}{6}] = [\frac{x+1}{2}] - [\frac{x+1}{3}]\) is true, \(\forall x \in \mathbb{R}\). <sup><sup><a href="#hint-10">Hint</a> &amp;  <a href="#answer-10">Answer</a></sup></sup></p>

<hr />

<p><strong>11.</strong> <sup><sup>medium</sup></sup> Prove that if \(\sum_{k=1}^{n} a_k = \sum_{k=1}^{n} a_k^2\) then \(\sum_{k=1}^{n} a_k \le n\), with \(a_k \in \mathbb{R}_{+}\). <sup><sup><a href="#hint-11">Hint</a> &amp;  <a href="#answer-11">Answer</a></sup></sup></p>

<hr />

<p><strong>12.</strong> <sup><sup>medium</sup></sup> If \(a^2+b^2+c^2=3\) prove (\(\lvert a \rvert + \lvert b \rvert + \lvert c \rvert - abc) \le 4\), where \(a,b,c \in \mathbb{R}\). <sup><sup><a href="#hint-12">Hint</a> &amp;  <a href="#answer-12">Answer</a></sup></sup></p>

<hr />

<p><strong>13.</strong> <sup><sup>hard</sup></sup> Prove \(\frac{a+b}{c^2}+\frac{b+c}{a^2}+\frac{c+a}{b^2} \ge 2(\frac{1}{a}+\frac{1}{b}+\frac{1}{c})\) if \(a,b,c \in \mathbb{R}_{+}^{*}\). <sup><sup><a href="#hint-13">Hint</a> &amp;  <a href="#answer-13">Answer</a></sup></sup></p>

<hr />

<p><strong>14.</strong>  <sup><sup>easy</sup></sup> Prove that if \(x \in \mathbb{R}\) and \(x^2+x \in \mathbb{Q}\) and \(x^3+2x \in \mathbb{Q}\), then \(x \in \mathbb{Q} \subset \mathbb{R}\).  <sup><sup><a href="#hint-14">Hint</a> &amp;  <a href="#answer-14">Answer</a></sup></sup></p>

<hr />

<p><strong>15.</strong> <sup><sup>medium</sup></sup> Given \(a,b \in \mathbb{R}\), we know \(3^a+13^b=17^a\), and \(5^a+7^b=11^b\). Prove \(a \lt b\). <sup><sup><a href="#hint-15">Hint</a> &amp;  <a href="#answer-15">Answer</a></sup></sup></p>

<hr />
<p><strong>16.</strong> <sup><sup>medium</sup></sup> For \(n \in \mathbb{N}, n \ge 2\), let \(u(n)\) be the biggest prime number \(\le n\) and \(v(n)\) be the smallest prime number \(\gt n\). Prove:</p>

\[\frac{1}{u(2)*v(2)}+\frac{1}{u(3)*v(3)}+...+\frac{1}{u(2010)*v(2010)}=\frac{1}{2}-\frac{1}{2021}\]

<p><sup><sup><a href="#hint-16">Hint</a> &amp;  <a href="#answer-16">Answer</a></sup></sup></p>

<hr />

<p><strong>17.</strong> <sup><sup>medium</sup></sup> Prove \(\frac{1}{x^2+yz}+\frac{1}{y^2+xz}+\frac{1}{z^2+xy} \le \frac{1}{2} (\frac{1}{xy}+\frac{1}{yz}+\frac{1}{xz})\),  \(\forall x,y,z \in \mathbb{R}_{+}^*\). <sup><sup><a href="#hint-17">Hint</a> &amp;  <a href="#answer-17">Answer</a></sup></sup></p>

<hr />

<p><strong>18.</strong> <sup><sup>medium</sup></sup> For \(a,b,c \in (0,1) \subset \mathbb{R}\), \(x,y,z \in (0, \infty) \subset \mathbb{R}\), if:</p>

\[\begin{cases}
a^x = bc \\
b^y = ca \\
c^z = ab
\end{cases}\]

<p>Prove that:</p>

\[\frac{1}{2+x} + \frac{1}{2+y} + \frac{1}{2+z} \le \frac{3}{4}\]

<p><sup><sup><a href="#hint-18">Hint</a> &amp;  <a href="#answer-18">Answer</a></sup></sup></p>

<hr />

<p><strong>19.</strong> <sup><sup>easy</sup></sup> If \(x,y,z \in R_{+}^{*}\), and \(xy=\frac{z-x+1}{y}=\frac{z+1}{2}\), prove that one of the numbers is the arithmetical mean of the other two. <sup><sup><a href="#answer-19">Answer</a></sup></sup></p>

<hr />

<p><strong>20.</strong> <sup><sup>medium</sup></sup> If \(a,b,c \in (1, \infty) or a,b,c \in (0,1)\). Prove:</p>

\[log_a(bc) + log_b(ca) + log_c(ab) \ge 4(log_{ab}(c) + log_{bc}(a) + log_{ca}b)\]

<p><sup><sup><a href="#hint-20">Hint</a> &amp;  <a href="#answer-20">Answer</a></sup></sup></p>

<hr />

<h1 id="hints">Hints</h1>

<h2 id="hint-1">Hint 1.</h2>

<p>Try playing with <a href="https://en.wikipedia.org/wiki/Faulhaber%27s_formula">Faulhaber’s formula</a>.</p>

<h2 id="hint-2">Hint 2.</h2>

<p>Find a way to <em>introduce</em> \(ab\) in the given equality \(a^2 + 2b^2=1\).</p>

<h2 id="hint-3">Hint 3.</h2>

<p>Try to get rid of the fractional part.</p>

<h2 id="hint-4">Hint 4.</h2>

<p>Try to do some substitutions based on the fact \(x=[x]+\{x\}\).</p>

<h2 id="hint-5">Hint 5.</h2>

<p>Use \(a\) to express \(b\) and \(c\).</p>

<h2 id="hint-6">Hint 6.</h2>

<p>Look for any patterns by computing the first few terms of the sequence.</p>

<h2 id="hint-7">Hint 7.</h2>

<p>Give <em>meaningful</em> values to \(a,b,c,d\) and see what’s happening.</p>

<p>Have you considered <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM inequality</a>?</p>

<h2 id="hint-8">Hint 8.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">Cauchy–Bunyakovsky–Schwarz</a> inequality to solve the problem?</p>

<h2 id="hint-9">Hint 9.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/Rearrangement_inequality">Rearrangement inequality</a> to solve the problem?</p>

<h2 id="hint-10">Hint 10.</h2>

<p>Can you use <a href="https://en.wikipedia.org/wiki/Hermite%27s_identity">Hermite’s identity</a> to solve the problem?</p>

<h2 id="hint-11">Hint 11.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">Cauchy–Bunyakovsky–Schwarz</a> inequality to solve the problem?</p>

<h2 id="hint-12">Hint 12.</h2>

<p>Can you use both <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">CBS</a> and <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM</a> inequalities?</p>

<h2 id="hint-13">Hint 13.</h2>

<p>Can you prove first \(\frac{x}{y^2}+\frac{y}{x^2} \ge \frac{1}{x} + \frac{1}{y}\) ?</p>

<h2 id="hint-14">Hint 14.</h2>

<p>Try expressing \(x\) as a relationship between two rational numbers.</p>

<h2 id="hint-15">Hint 15.</h2>

<p>Think in terms of <a href="https://en.wikipedia.org/wiki/Monotonic_function">monotonically increasing</a> and <a href="https://en.wikipedia.org/wiki/Monotonic_function">monotonically decreasing</a> functions.</p>

<h2 id="hint-16">Hint 16.</h2>

<p>How many times a term \(\frac{1}{u(n)*v(n)}\) appears in the sum ?</p>

<h2 id="hint-17">Hint 17.</h2>

<p>Can you find a way to use the <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM inequality</a>?</p>

<h2 id="hint-18">Hint 18.</h2>

<p>Work on the expressions involving logarithms. Consider changing the base of the logarithms to a common one.</p>

<h2 id="hint-19">Hint 19.</h2>

<p>This exercise is easy, so it doesn’t deserve a hint.</p>

<h2 id="hint-20">Hint 20.</h2>

<p>Consider changing the base of the logarithms to a common one.</p>

<h1 id="answers">Answers</h1>

<h2 id="answer-1">Answer 1.</h2>

<p>We write our sum as:</p>

\[S=(1^2-2^2)+(3^2-4^2)+...+(99^2-100^2)\]

<p>There is a formula for the difference of two square numbers:</p>

\[a^2-b^2=(a-b)(a+b)\]

<p>Our \(S\) is a sum of differences between subsequent square numbers:</p>

\[S=(1-2)(1+2)+(3-4)(3+4)+...+(99-100)(99+100) \Leftrightarrow\]

\[S=-3-7-11-...-199\]

<p>If you have a keen eye for observations, you notice the numbers \(3,7,11,...,199\) have this form \(3+k*4\), \(k=0..49\).</p>

\[S=-(3+0*4)-(3+1*4)-(3+2*4)-...-(3+49*4) \Leftrightarrow\]

\[S=-3*50-4(0+1+2+...+49) \Leftrightarrow\]

<p>The infinite series whose terms are natural numbers,  \(1+2+3+...+n\), is divergent. But we know the \(nth\) partial sum of the series to be: \(\sum_{k=1}^{n}k=\frac{n(n+1)}{2}\), so:</p>

\[S=-150-4*\frac{49(49+1)}{2}\]

<p>The final answer \(S=-150-4900=-5050\).</p>

<hr />

<h1 id="answer-1-1">Answer 1.</h1>

<p>If you are familiar with <a href="https://en.wikipedia.org/wiki/Faulhaber%27s_formula">Faulhaber’s formula</a>, you know that:</p>

\[\sum_{k=1}^n k = \frac{n(n+1)}{2}\]

\[\sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}\]

<p>We can cleverly use the two formulas and reimagine our \(S\) to be:</p>

\[S=\underbrace{(1^2+2^2+3^2+...+100^2)}_{\sum_{k=1}^{100} k^2} - \underbrace{2*(2^2+4^2+6^2+..+100^2)}_{\sum_{k=1}^{50} (2k)^2} \Leftrightarrow\]

\[S=\frac{100*101*201}{6}-2*(2^2*1^2+2^2*2^2+2^2*3^2+...+2^2*50^2) \Leftrightarrow\]

\[S=\frac{100*101*201}{6}-8*\frac{50*51*101}{6}\]

<p>Final answer \(S=-5050\).</p>

<hr />

<h1 id="answer-2">Answer 2.</h1>

<p>The intuition begs us to find a way to link our existing relationship to a term containing \(ab\). In this regard:</p>

\[1=a^2+2b^2=a^2 + (b\sqrt{2})^2 \Leftrightarrow\]

\[1=a^2 + \underbrace{2*\sqrt{2}ab}_{\text{we add this}} + (b\sqrt{2})^2 - \underbrace{2*\sqrt{2}ab}_{\text{to remove it later}}  \Leftrightarrow\]

\[1=(a+b\sqrt{2})^2 - 2\sqrt{2}ab \Leftrightarrow\]

\[1+2\sqrt{2}ab=(a+b\sqrt{2})^2\]

<p>But we know that:</p>

\[(a+b\sqrt{2})^2 \geq 0 \Rightarrow\]

\[1+2\sqrt{2}ab \geq 0 \Rightarrow\]

\[ab \geq \frac{-1}{2\sqrt{2}}\]

<p>But is it possible for \(ab=\frac{-1}{2\sqrt{2}}\). Yes, \(ab=\frac{-1}{2\sqrt{2}}\) when \((a+b\sqrt{2})^2=0\).</p>

<p>All in all, the smallest element of our set is \(\frac{-1}{2\sqrt{2}}\).</p>

<hr />

<h1 id="answer-3">Answer 3.</h1>

<p>If \(a \in \mathbb{R}\), then:</p>

\[a=[a]+\{a\} \Leftrightarrow\]

\[\{a\}=a-[a]\]

<p>With this in mind, we want to get rid of <em>the wild</em> fractional part \(\{a\}\) from our relationship:</p>

\[[\frac{x+1}{5}]=\frac{x-1}{2} - [\frac{x-1}{2}] \Leftrightarrow\]

\[\underbrace{[\frac{x+1}{5}]}_{\in \mathbb{Z}}+\underbrace{[\frac{x-1}{2}]}_{\in \mathbb{Z}}=\frac{x-1}{2}\]

<p>We can safely say that \(\frac{x-1}{2}=k \in \mathbb{Z}\).</p>

<p>We substitute \(x=2k+1\) in the original relation:</p>

\[[\frac{2*k+1+1}{5}] + [\frac{2*k+1-1}{2}] = k \Leftrightarrow\]

\[[\frac{2k+2}{5}] + k = k \Leftrightarrow\]

\[[\frac{2k+2}{5}] = 0\]

<p>Because \([\frac{2k+2}{5}] = 0\), then:</p>

\[0 \leq \frac{2k+2}{5} \lt 1 \Leftrightarrow\]

\[-1 \leq k \lt \frac{3}{2}\]

<p>There are \(3\) numbers \(k \in \mathbb{Z}\) that satisfy the relationship: \(\{-1,0,1\}\).</p>

<p>But, \(x=2k+1 \Rightarrow  x \in \{-1, 1, 3\}\).</p>

<p>Testing our solutions:</p>

\[x = -1 \Rightarrow [\frac{-1+1}{5}] = \{ \frac{-1-1}{2} \} \Leftrightarrow [0] = \{ -1 \} \text{ is true}\]

\[x = 1 \Rightarrow [\frac{1+1}{5}] = \{ \frac{1-1}{2} \} \Leftrightarrow [\frac{2}{5}] = \{ 0 \} \text{ is true}\]

\[x = 1 \Rightarrow [\frac{3+1}{5}] = \{ \frac{3-1}{2} \} \Leftrightarrow [\frac{4}{5}] = \{ 1 \} \text{ is true}\]

<p>So the cardinality is \(3\).</p>

<h1 id="answer-4">Answer 4.</h1>

<p>To <a href="https://en.wikipedia.org/wiki/Division_by_zero">avoid division by zero</a> in \(\frac{3}{2x}\), we know that \(x \neq 0\).</p>

<blockquote>
  <p>Note: The <em>fractional part operation</em> (denoted by \(\{a\}\)) is not distributive over multiplication, meaning \(\{a*b\} \neq \{a\} * \{b\}\), so avoid making any further assumptions about \(\frac{1}{\{x\}}\).</p>
</blockquote>

<p>Firstly, \(\frac{1}{[x]} + \frac{1}{\{x\}}=2x\) is equivalent to \(\frac{x}{[x]\{x\}}=2x\), is equivalent to \(x(2[x]\{x\}-1)=0\).</p>

<p>Because \(x \neq 0\), then \(2[x]\{x\}=1\), or \(\{x\}=\frac{1}{2[x]}\).</p>

<p>We substitute \([x]=n\), so that \(\{x\}=\frac{1}{2n}\), where \(n \in \mathbb{Z}\) and \(n \geq 1\).</p>

<p>\(x=[x]+{x}\) becomes \(x=n+\frac{1}{2n}=\frac{2n^2+1}{2n}\).</p>

<p>The term defining the set becomes \([\frac{3}{2x}] \rightarrow [\frac{3}{2*\frac{2n^2+1}{2n}}]=[\frac{3n}{2n^2+1}]\).</p>

<p>For \(n \ge 1\), we know that \(0 \lt \frac{3n}{2n^2+1} \lt 1\). Without calculus, we can easily prove that for \(n \ge 1\), \(f(n)=3n\), and \(g(n)=2n^2+1\) are increasing functions, with \(g(n)\) <em>increasing faster</em>, so that \(\frac{f(n)}{g(n)} \lt 1\).</p>

<p>For certain we know that \(0 \lt \frac{3n}{2n^2+1}\).</p>

<p>After we solve \(\frac{3n}{2n^2+1} \lt 1\), we obtain \(n \ge 1\).</p>

<p>For \(n=1\), \([\frac{3}{2x}] \rightarrow 1\), for \(n \gt 1\), \([\frac{3}{2x}] \rightarrow 0\).</p>

<p>So the set \(\{\frac{3}{2x} \lvert x \in \mathbb{R} \text{ and, } \frac{1}{[x]} + \frac{1}{\{x\}}=2x \} = \{0, 1\}\)</p>

<h1 id="answer-5">Answer 5.</h1>

<p>\((a,b,c)\) are in an <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">arithmetic progression</a> \(\Rightarrow b=\frac{a+c}{2}\).</p>

<p>\((ab, bc, ac)\) are in a <a href="https://en.wikipedia.org/wiki/Geometric_progression">geometric progression</a> \(\Rightarrow (bc)^2 = ab*ac\).</p>

<p>With this in mind, we have the following relationships:</p>

\[\begin{cases}
        b=\frac{a+c}{2} \\
        (bc)^2 = ab*ac \\
        a+b+c=ab+bc+ca
\end{cases}\]

<p>It doesn’t look like it, but we have enough <em>information</em> to determine \((a,b,c)\)</p>

\[\begin{cases}
        2b=a+c \\
        bc=a^2 \Leftrightarrow c=\frac{a^2}{b}\\
        3b=ab+bc+ac
\end{cases}\]

<p>But we can also write \(2b=a+\frac{a^2}{b}\).</p>

<p>Putting all together in the last equation:</p>

\[3b=ab+\underbrace{bc}_{a^2}+a\underbrace{c}_{\frac{a^2}{b}} \Leftrightarrow \\
3b=ab+a^2+\frac{a^3}{b} \Leftrightarrow \\
3b=a(\underbrace{a+\frac{a^2}{b}}_{2b})+ab \Leftrightarrow \\
3b=2ab+ab\]

<p>But because \(b \in \mathbb{R}^{*}\), and \(3b=3ab\), we can safely assume \(a=1\).</p>

<p>If \(a=1\), the relationship \(2b=a+c\) becomes \(2b=1+\frac{1}{b} \Leftrightarrow 2b^2-b-1=0\).</p>

<p>\(2b^2-b-1=0\) can also be written as \(2b^2+b-(2b+1)=0\) or \(b(2b+1)-(2b+1)=0 \Leftrightarrow (b-1)(2b+1)=0\), so \(b=1\) or \(b=-\frac{1}{2}\).</p>

<p>For \(b=1\), \(c=1\), and for \(b=-\frac{1}{2}\), \(c=-2\).</p>

<p>So our triplets are \((1,1,1)\) or \((1,-\frac{1}{2}, -2)\).</p>

<p>Computing the sum is trivial: \(\sum=\frac{13}{2}\).</p>

<h2 id="answer-6">Answer 6.</h2>

<p>The key to solving this exercise is to compute the first terms of the sequence:</p>

\[\begin{cases}
    a_1=2 \\
    a_2=6 \\
    a_3=\frac{6}{2}=3 \\
    a_4=\frac{3}{6}=\frac{1}{2} \\
    a_5=\frac{\frac{1}{2}}{3}=\frac{1}{6} \\
    a_6=\frac{\frac{1}{6}}{\frac{1}{3}}=\frac{1}{3} \\
    a_7=\frac{\frac{1}{3}}{\frac{1}{6}}=2 \\
    a_8=\frac{2}{\frac{1}{3}}=6 \\
    \text{... and so on}
\end{cases}\]

<p>We can see that after every 6 terms, the values repeat themselves. Using mathematical induction, we can prove that our sequence is:</p>

\[S(n)=
\begin{cases}
    2 \text{   ,}\text{ if }n=6*k+1 \\
    6 \text{   ,}\text{ if }n=6*k+2 \\
    3 \text{   ,}\text{ if }n=6*k+3 \\
    \frac{1}{2} \text{   ,}\text{ if }n=6*k+4 \\
    \frac{1}{6} \text{   ,}\text{ if }n=6*k+5 \\
    \frac{1}{3} \text{   ,}\text{ if }n=6*k 
\end{cases}
\text{, where } k \in \mathbb{N}\]

<p>Final answer is: \(a_{2021} = \frac{1}{6}\)</p>

<h2 id="answer-7">Answer 7.</h2>

<p>When you have problems like this, you need to consider giving specific values to \(a,b,c,d\) that can help you narrow down your search.</p>

<p>For example, we know the inequality should hold regardless of \(a, b, c, d\) (\(\forall\)), so let’s assume the following:</p>

\[a=b=c=d=n\]

<p>Then:</p>

\[4*n^4+k*n^4 \ge 0 \Leftrightarrow \\
k \ge -4\]

<p>This already tells us that we need to look somewhere in \(k \in [-4, \infty) \cap \mathbb{Z}\).</p>

<blockquote>
  <p>On my first try, I’ve tried with \(a^2=b^2=m\) and \(c^2=b^2=n\), so I’ve got something like \((n\sqrt{2} - m\sqrt{2})^2 + mn*(k+4) \ge 0\).</p>
</blockquote>

<p>Now, we need to find an upper bound for \(k\). For this, we need to apply some tricks to obtain:</p>

\[\text{something positive} + (\text{an upper bound}-k)*(\text{something positive}) \ge 0\]

<p>So why don’t we pick:</p>

\[\begin{cases}
    a=b=c=n \\
    d=-n
\end{cases}\]

<p>Then our relationship becomes:</p>

\[4*n^4 - k*n^4 \ge 0 \Leftrightarrow \\
k \le 4\]

<p>So, at this point, we know that \(k \in [-4, 4] \cap \mathbb{Z}\). Some would stop here, and that would be wrong.</p>

<p>We need to come up with stronger proof. Our findings, \(k \in [-4, 4] \cap \mathbb{Z}\) were based on specific values for \(a,b,c,d\).</p>

<p>One famous inequality in mathematics is <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">the inequality of arithmetic and geometric means</a>:</p>

\[(\frac{x_1^n+x_2^n+...+x_n^n}{n})^{\frac{1}{n}} \ge ... \ge \frac{x_1+x_2+...+x_n}{n} \ge (x_1 * x_2 * ... * x_n)^{\frac{1}{n}}\]

<p>If you are good at spotting patterns, you will see how it resembles our inequality.</p>

\[\begin{cases}
    x_1 \rightarrow \lvert a \rvert  \\
    x_2 \rightarrow \lvert b \rvert  \\
    x_3 \rightarrow \lvert c \rvert  \\
    x_4 \rightarrow \lvert d \rvert 
\end{cases}\]

<p>So, if, we consider this:</p>

\[(\frac{\lvert a \rvert ^4 + \lvert b \rvert ^4 +\lvert c \rvert ^4+\lvert d \rvert ^4}{4})^{\frac{1}{4}} \ge (\lvert a \rvert * \lvert b \rvert * \lvert c \rvert * \lvert d\rvert)^{\frac{1}{4}} \Leftrightarrow \\
a^4+b^4+c^4+d^4 \ge 4 * \lvert abcd \rvert\]

<ul>
  <li>If \(abcd \ge 0\)
    <ul>
      <li>Then \(a^4+b^4+c^4+d^4 + k*abcd \ge 4*abcd + k*abcd\);</li>
      <li>But \(abcd*(k+4) \ge 0\), for \(k \in [-4,4] \cap \mathbb{Z}\);</li>
    </ul>
  </li>
  <li>If \(abcd \lt 0\)
    <ul>
      <li>Then \(a^4+b^4+c^4+d^4 + k*abcd \ge -4*abcd + k*abcd\);</li>
      <li>But \(-abcd(4-k) \ge 0\), for \(k \in [-4, 4] \cap \mathbb{Z}\).</li>
    </ul>
  </li>
</ul>

<p>This tells us that the inequality works \(\forall k \in -4, 4 \cap \mathbb{Z}\).</p>

<h2 id="answer-8">Answer 8.</h2>

<p>The first observation you should make is that \(2021=43*41\).</p>

<p>When we have problems like this, it’s worth checking if using the two fundamental inequalities, <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM inequality</a> and <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">Cauchy–Bunyakovsky–Schwarz</a> helps us.</p>

<p>Even if not fully obvious in our case, the one that helps is the <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequalit">CBS</a>:</p>

\[(\sum_{i=1}^{n} a_i^2) * (\sum_{i=1}^{n}b_i^2) \ge (\sum_{i=1}^{n}a_i*b_i)^2 \\
\text{ equality holds if } \frac{a_i}{b_i}=k \text{, for } k \in \mathbb{R}\]

<p>For 3 pair of numbers, \((a_1, b_1), (a_2, b_2), (a_3, b_3)\), CBS looks like this:</p>

\[(a_1*b_1 + a_2*b_2 + a_3*b_3)^2 \le (a_1^2 + a_2^2 + a_3^2) * (b_1^2 + b_2^2 + b_3^2)\]

<p>Firstly, we know that:
\(2021 \le (1*x+(-3)y+6z+(-1)*t)^2\)</p>

<p>So, thinking in terms of the CBS inequality, why don’t we consider the following:</p>

\[\begin{cases}
    a_1 \rightarrow x \\
    a_2 \rightarrow y \\
    a_3 \rightarrow z \\
    a_4 \rightarrow t \\
\end{cases}\]

<p>and</p>

\[\begin{cases}
    b_1 \rightarrow 1 \\
    b_2 \rightarrow -3 \\
    b_3 \rightarrow 6 \\
    b_4 \rightarrow -1 \\
\end{cases}\]

<p>In this regard, we can write things like this:</p>

\[2021 \le (x-3y+6z+t)^2 \le \underbrace{(1^2+(-3)^2+6^2+1^2)}_{47}*\underbrace{(x^2+y^2+z^2+t^2)}_{\le 43} \le 2021\]

<p>This means our expression, \((x-3y+6z+t)^2\) is squeezed between \(2021\) and \(2021\), so the equality holds true, so:</p>

\[\frac{x}{1}=\frac{y}{-3}=\frac{z}{6}=\frac{t}{-1}=k \text{ , } k \in \mathbb{R}\]

<p>Or:</p>

\[\begin{cases}
    x=k \\
    y=-3k \\
    z=6k \\
    t=-k
\end{cases}
\text{ , } k \in \mathbb{R}\]

<p>If we use this substitution:</p>

\[x^2+y^2+z^2+t^2 \le 43 \Leftrightarrow \\
k^2 + 9k^2+36k^2+k^2 \le 43 \\
47k^2 \le 43 \\
k \le \sqrt{\frac{43}{47}}\]

<p>And then again:</p>

\[(x-3y+6z-t)^2 \ge 2021 \\
(k+9k+36k+k)^2 \ge 43*47 \\
47^2*k^2 \ge 43*47 \\
k^2 \ge \frac{43}{47} \\
k \ge \sqrt{\frac{43}{47}}\]

<p>So we can safely assume that our \(k=\sqrt{\frac{43}{47}}\).</p>

<p>Now it’s easy to compute the expression: \(\lvert x^2 + y^2 + z^2 + t^2 \rvert=3 * \sqrt{\frac{43}{47}}\).</p>

<h2 id="answer-9">Answer 9.</h2>

<p>For 6 numbers: \(x_1 \le x_2 \le x_3\) and \(y_1 \le y_2 \le y_3\) the <a href="https://en.wikipedia.org/wiki/Rearrangement_inequality">Rearrangement inequality</a> can be written as:</p>

\[x_1*y_2 + x_2*y_3+x_3*y_1 \le x_1*y_1 + x_2*y_2 + x_3*y_3\]

<p>If we pick:</p>

\[\begin{cases}
    x_1=y_1=a \\
    x_2=y_2=b \\
    x_3=y_3=c \\
\end{cases}\]

<p>We obtain:</p>

\[ab+bc+ca \le a^2 + b^2 + c^2 (*)\]

<p>Then:</p>

\[2(ab+bc+ca) + ab+bc+ca \le 2(ab+bc+ca) + a^2 + b^2 + c^2 \Leftrightarrow \\
3(ab+bc+ca) \le (a+b+c)^2 (**)\]

<p>Now, let’s get to our problem. We will compute the \(\Delta\) for \(x^2 + (a+b+c)x + k(ab+bc+ca) = 0\):</p>

\[\Delta=(a+b+c)^2-4k(ab+bc+ca)\]

<p>For our equation to have solutions in \(\mathbb{R}\), we need to find \(k\) so that \(\Delta \ge 0\).</p>

\[\Delta = \underbrace{(a+b+c)^2}_{\ge 3(ab+bc+ca)} - 4k(ab+bc+ca) \ge 0 \\\]

<p>Using (**), we can write:</p>

\[\Delta \ge 3(ab+bc+ca) - 4k(ab+bc+ca) \ge 0 \Leftrightarrow \\
(3-4k) \ge 0 \Rightarrow
k \le \frac{3}{4}\]

<h2 id="answer-10">Answer 10.</h2>

<p><a href="https://en.wikipedia.org/wiki/Hermite%27s_identity">Hermite’s Identity</a> states that:</p>

\[\sum_{k=0}^{n-1}[x+\frac{k}{n}] = [nx] \text{ , } \forall x \in \mathbb{R} \text{ ,and } n \in \mathbb{N}\]

<p>One idea is to make our existing terms (e.g. [\(\frac{x+3}{6}\)]) resemble the terms to Hermite’s identity (\([x+\frac{k}{n}]\)). In this regard we need to find a way to “isolate” the \(x\) outside the fraction(s).</p>

<p>One idea is to perform the following substitution:</p>

\[y=\frac{x+1}{6}\]

<p>So our identity becomes:</p>

\[[y+\frac{1}{3}] - [y+\frac{1}{2}] + [y+\frac{2}{3}] = [3y] - [2y] \text{    (*)}\]

<p>But:</p>

\[\begin{cases}
    [3y] = [y] + [y+\frac{1}{3}] + [y+\frac{2}{3}] \\
    [2y] = [y] + [y+\frac{1}{2}]
\end{cases}
\text{    (**)}\]

<p>(*) and (**) proves the identity to be correct.</p>

<h2 id="answer-11">Answer 11.</h2>

<p>Even if it’s  not obvious, let’s start again with the CBS inequality:</p>

\[(\sum_{i=1}^{n} a_i^2) * (\sum_{i=1}^{n}b_i^2) \ge (\sum_{i=1}^{n}a_i*b_i)^2 \\\]

<p>If we pick \(b_1=b_2=b_3=...=b_n=1\) the inequality becomes:</p>

\[(\sum_{i=1}^{n} a_i^2) * n \ge (\sum_{i=1}^{n}a_i)^2\]

<p>Expanding the sums:</p>

\[(a_1+a_2+...+a_n)^2 \le n*(a_1^2 + a_2^2 + ...+ a_n^2)\]

<p>\(a_k \in \mathbb{R}_{+}\) so we can conclude:</p>

\[a_1+a_2+...b_n \le n\]

<h2 id="answer-12">Answer 12.</h2>

<p><strong>12.</strong> <sup><sup>easy</sup></sup> If \(a^2+b^2+c^2=3\) prove (\(\lvert a \rvert + \lvert b \rvert + \lvert c \rvert - abc) \le 4\), where \(a,b,c \in \mathbb{R}\). <sup><sup><a href="#hint-12">Hint</a> &amp;  <a href="#answer-13">Answer</a></sup></sup></p>

<p>The following is true (\(\forall a,b,c \in \mathbb{R}\)):</p>

\[a^2 + b^2 + c^2 = \lvert a \rvert^2 + \lvert b \rvert^2 + \lvert c \rvert^2 = 3\]

<p>Applying <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">Cauchy–Bunyakovsky–Schwarz</a>:</p>

\[\underbrace{(a^2 + b^2 + c^2)}_{=3} * \underbrace{(1^2 + 1^2 + 1^2)}_{=3} \ge (\lvert a \rvert*1 + \lvert b \rvert*1 + \lvert c \rvert*1)^2\]

<p>From this \(\Rightarrow 3 \ge (\lvert a \rvert + \lvert b \rvert + \lvert c \rvert)\) (*).</p>

<p>Applying <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM inequality</a>:</p>

\[\frac{a^2+b^2+c^2}{3} \ge (abc)^{\frac{2}{3}}\]

<p>We can safely observe \(-abc \le 1\) (**).</p>

<p>(*) and (**) \(\Rightarrow\):</p>

\[\underbrace{\lvert a \rvert + \lvert b \rvert + \lvert c \rvert}_{\le 3} \underbrace{- abc}_{\le 1} \le 4 \text{ is TRUE}\]

<h2 id="answer-13">Answer 13.</h2>

<p>Looking at:</p>

\[\frac{a+b}{c^2}+\frac{b+c}{a^2}+\frac{c+a}{b^2} \ge 2(\frac{1}{a}+\frac{1}{b}+\frac{1}{c})\]

<p>We can group things in the following manner:</p>

\[\underbrace{\frac{a}{b^2}+\frac{b}{a^2}}_{*} + \underbrace{\frac{b}{c^2}+\frac{c}{b^2}}_{**} + \underbrace{\frac{a}{c^2} + \frac{c}{a^2}}_{***} \ge \underbrace{\frac{1}{a} + \frac{1}{b}}_{*} + \underbrace{\frac{1}{b} + \frac{1}{c}}_{**} + \underbrace{\frac{1}{a} + \frac{1}{c}}_{***}\]

<p>There’s a pattern here!! If we manage to solve this inequality: \(\frac{m}{n^2} + \frac{n}{m^2} \ge \frac{1}{n} + \frac{1}{m}\), \(m,n \in \mathbb{R}_{+}^*\) we will be able solve our problem.</p>

<p>So let’s solve this:</p>

\[\frac{m}{n^2} + \frac{n}{m^2} \ge \frac{1}{n} + \frac{1}{m} \Leftrightarrow \\\]

\[m^3 + n^3 = mn(m+n) \ge 0 \Leftrightarrow \\\]

\[m^2(m-n)-n^2(m-n) \ge 0 \Leftrightarrow \\\]

\[(m-n)(m^2-n^2) \ge 0 \Leftrightarrow \\\]

\[\underbrace{(m-n)^2}_{\ge 0} * \underbrace{(m+n)}_{\gt 0} \ge 0\]

<p>Now, we know the following:</p>

\[\begin{cases}
    \frac{a}{b^2}+\frac{b}{a^2} \ge \frac{1}{a} + \frac{1}{b} \\
    \frac{b}{c^2}+\frac{c}{b^2} \ge \frac{1}{b} + \frac{1}{c} \\
    \frac{a}{c^2}+\frac{c}{a^2} \ge \frac{1}{a} + \frac{1}{c}
\end{cases}\]

<p>If we sum all three inequalities, we’ve proven the original inequality.</p>

<h2 id="answer-14">Answer 14.</h2>

<p>If \(x^2+x \in \mathbb{Q}\) , then \(x^2+x=a \in \mathbb{Q}\)</p>

<p>If \(x^3+2x \in \mathbb{Q}\) , then \(x^3+2x=b \in \mathbb{Q}\).</p>

<p>Our purpose is to try expressing \(x\) using only \(a\) and \(b\) in a way we will prove \(x \in \mathbb{Q}\).</p>

<p>We start by doing some tricks with \(b=x^3+2x=x^3+\underbrace{(x^2-x^2)}_{=0}+\underbrace{(x-x)}_{=0}+2x\).</p>

<p>After regrouping terms, \(b\) becomes \(b=x\underbrace{(x^2+x)}_{=a}-\underbrace{(x^2+x)}_{=a} + x + 2x\).</p>

<p>So \(b=x(a+3)-a\), or \(a+b=x(a+3)\).</p>

<p>We are getting closer to the solution; the only thing remaining is to check if \(a=-3\).</p>

<p>Let’s suppose \(a=-3\), then \(x^2+x+3=0\), but this is impossible because the solutions  \(x_1,x_2 \notin \mathbb{R}\). So, we can safely assume \(a \neq 3\).</p>

<p>If \(a \neq 3\), then we can write \(x=\frac{a+b}{a+3}\). But both \(a+b \in Q\) and \(a+3 \in Q\), then for sure \(x \in Q\).</p>

<h2 id="answer-15">Answer 15.</h2>

<p>The fact that \(3,5,7,11,13\) are all prime numbers is just a coincidence, but congratulations if you spot that.</p>

<p>Sometimes, it is easier to disprove, than to prove something, so <a href="https://en.wikipedia.org/wiki/Reductio_ad_absurdum">ad absurdum</a> let’s suppose \(a \ge b\).</p>

<p>Firstly, for the function \(f(x)=a^x\), if \(a\) is a constant greater than 1, we say that the function is increasing, meaning the value of \(f(x)\) increases with \(x\). Secondly, if \(a \lt 1\), then we say the function is decreasing, meaning the value of \(f(x)\) decreases while \(x\) increases.</p>

<p>That being said, if \(a \ge b\), then \(13^a \ge 13^b\) and \(5^a \ge 5^b\).</p>

<p>This means that \(3^a + 13^a \ge 17^a\), or \((\frac{3}{17})^a + (\frac{13}{17})^a \ge 1\).</p>

<p>Let \(g(x) : \mathbb{R} \rightarrow \mathbb{R}\), \(g(x)=(\frac{3}{17})^x + (\frac{13}{17})^x\). \(g(x)\) is stricly decreasing. Also, \(g(1)=\frac{16}{17} \lt 1\). But \(g(1) \lt g(a)\) thus, \(a \lt 1\) <code class="language-plaintext highlighter-rouge">(*)</code>.</p>

<p>If our initial supposition is correct, then \(5^b+7^b \ge 11^b\). Following the same principle, we define \(h(x)=(\frac{5}{11})^b+(\frac{7}{11})^b \ge 1\) and we eventually conclude that \(b \gt 1\) <code class="language-plaintext highlighter-rouge">(**)</code>.</p>

<p><code class="language-plaintext highlighter-rouge">(*)</code> and <code class="language-plaintext highlighter-rouge">(**)</code> \(\Rightarrow\) our supposition is false, so \(a \lt b\) is true.</p>

<h2 id="answer-16">Answer 16.</h2>

<p>This problem is easier than it looks.</p>

\[S=\underbrace{\frac{1}{u(2)*v(2)}}_{=\frac{1}{2*3}}+\underbrace{\frac{1}{u(3)*v(3)}}_{=\frac{1}{3*5}}+\underbrace{\frac{1}{u(4)*v(4)}}_{=\frac{1}{3*5}}+\underbrace{\frac{1}{u(5)*v(5)}}_{=\frac{1}{5*7}}+\underbrace{\frac{1}{u(6)*v(6)}}_{=\frac{1}{5*7}}+\underbrace{\frac{1}{u(7)*v(7)}}_{=\frac{1}{7*11}}...\]

<p>We see that the terms in our sum repeat themselves a number of times.</p>

<p>For example:</p>
<ul>
  <li>\(\frac{1}{2*3}\) appears once;</li>
  <li>\(\frac{1}{3*5}\) appears two times;</li>
  <li>\(\frac{1}{5*7}\) appears two times;</li>
  <li>\(\frac{1}{7*11}\) will appear four times;</li>
  <li>… and so on.</li>
</ul>

<p>If \(p, q\) are consecutive prime numbers, we define the set \(M=\{ n \in \mathbb{N} \lvert q \le n \lt p \}\). Th cardinal of \(M\) is exactly \(p-q\) for a given \(n\). It means that each term \(\frac{1}{qp}\) appears exactly \(p-q\) times in our sum.</p>

<p>With this in mind, we can re-write our sum as:</p>

\[S=\frac{3-2}{2*3}+\frac{5-3}{5*3}+\frac{7-5}{5*7}+\frac{11-7}{7*11}+... \Leftrightarrow\]

\[S=\frac{1}{2}-\frac{1}{3}+\frac{1}{3}-\frac{1}{5}+\frac{1}{5}+...+\frac{1}{2003}-\frac{1}{2011} \Leftrightarrow\]

\[S=\frac{1}{2}-\frac{1}{2011}\]

<h2 id="answer-17">Answer 17.</h2>

<p>We use the <a href="https://en.wikipedia.org/wiki/AM%E2%80%93GM_inequality">AM-GM inequality</a> for each of the following terms:</p>

\[x^2+yz \le 2\sqrt{x^2yz} = 2x\sqrt{yz} \Leftrightarrow \\\]

\[\frac{1}{x^2+yz} \le \frac{\sqrt{yz}}{2xyz} (*) \\\]

<p>But \(\sqrt{yz} \le \frac{y+z}{2} (**)\).</p>

<p>\((*), (**) \Rightarrow\):</p>

\[\frac{1}{x^2+yz} \le \frac{\frac{y+z}{2}}{2xyz}\]

<p>Similarly, for the other terms:</p>

\[\frac{1}{y^2+xz} \le \frac{\frac{x+z}{2}}{2xyz}\]

\[\frac{1}{z^2+xy} \le \frac{\frac{x+y}{2}}{2xyz}\]

<p>If we sum everything up:</p>

\[\frac{1}{x^2+yz} + \frac{1}{y^2+xz} + \frac{1}{z^2+xy} \le \frac{\frac{y+z}{2}}{2xyz} + \frac{\frac{x+z}{2}}{2xyz} + \frac{\frac{x+y}{2}}{2xyz} \Leftrightarrow \\\]

\[\frac{1}{x^2+yz} + \frac{1}{y^2+xz} + \frac{1}{z^2+xy} \le \frac{1}{2}(\frac{x+y+z}{xyz}) \Leftrightarrow \\\]

\[\frac{1}{x^2+yz} + \frac{1}{y^2+xz} + \frac{1}{z^2+xy} \le \frac{1}{2} (\frac{1}{xy} + \frac{1}{yz} + \frac{1}{xz})\]

<h2 id="answer-18">Answer 18.</h2>

<p>Let’s start by working on the expressions involving logarithms.</p>

\[\begin{cases}
a^x = bc \Leftrightarrow log_a(a^x) = log_a(bc) \Leftrightarrow x = log_a(b) + log_a(c) \\
b^y = ca \Leftrightarrow log_b(b^y) = log_b(ca) \Leftrightarrow y = log_b(c) + log_b(a) \\
c^z = ab \Leftrightarrow log_c(c^z) = log_c(ab) \Leftrightarrow c = log_c(a) + log_c(b) \\
\end{cases}\]

<p>Now, <a href="https://en.wikipedia.org/wiki/List_of_logarithmic_identities#Changing_the_base">let’s change the base for our logarithms</a> to a <em>common</em> number, \(m \in \mathbb{R}_{+}^{*}\):</p>

\[\begin{cases}
x = log_a(b) + log_a(c) = \frac{log_m(b)}{log_m(a)} + \frac{log_m(c)}{log_m(a)} \\
y = log_b(c) + log_b(a) = \frac{log_m(c)}{log_m(b)} + \frac{log_m(a)}{log_m(b)} \\
c = log_c(a) + log_c(b) = \frac{log_m(a)}{log_m(c)} + \frac{log_m(b)}{log_m(c)} \\
\end{cases}\]

<p>Let’s define \(l_a = log_m(a)\), \(l_b = log_m(b)\), \(l_c = log_m(c)\).</p>

<p>We observe that, \(x,y,z\) can be written as:</p>

\[\begin{cases}
x=\frac{l_b+l_c}{l_a} \\
y=\frac{l_c+l_a}{l_b} \\
z=\frac{l_a+l_b}{l_c}
\end{cases}\]

<p>The expression required to be proven becomes:</p>

\[\frac{1}{2+\frac{l_b+l_c}{l_a}}+\frac{1}{2+\frac{l_c+l_a}{l_b}}+\frac{1}{2+\frac{l_a+l_b}{l_c}} \le \frac{3}{4} \Leftrightarrow\]

\[\frac{l_a}{l_a + \underbrace{(l_a + l_b + l_c)}_{s_l}} + \frac{l_b}{l_b+\underbrace{(l_a+l_b+l_c)}_{s_l}} + \frac{l_c}{l_c+\underbrace{(l_a+l_b+l_c)}_{s_l}} \le \frac{3}{4} \Leftrightarrow\]

\[1-\frac{l_a}{l_a+s_l}+1-\frac{l_b}{l_b+s_l}+1-\frac{l_c}{l_c+s_l} \ge 3-\frac{3}{4} \Leftrightarrow\]

\[\frac{s_l}{l_a+s_l} + \frac{s_l}{l_b+s_l} + \frac{s_l}{l_c+s_l} \ge \frac{9}{4} \Leftrightarrow\]

\[4*s_l(\frac{1}{l_a+s_l} + \frac{1}{l_b+s_l} + \frac{1}{l_c+s_l}) \ge 9\]

<p>Let’s suppose \(l_a \le l_b \le l_c\), also \(l_a&gt;0\), then:</p>

\[4*s_l(\frac{1}{l_a+s_l} + \frac{1}{l_b+s_l} + \frac{1}{l_c+s_l}) \ge 4*s_l(\frac{1}{l_a+s_l} + \frac{1}{l_a+s_l} + \frac{1}{l_a+s_l}) \ge 9\]

<p>So:</p>

\[4*s_l(\frac{1}{l_a+s_l}) \ge 3 \Leftrightarrow\]

\[1-s_l(\frac{1}{l_a+s_l}) \le \frac{1}{4} \Leftrightarrow\]

\[\frac{l_a}{l_a+l_a+l_b+l_c} \le \frac{l_a}{4*l_a} \le \frac{1}{4}\]

<h2 id="answer-19">Answer 19.</h2>

<p>\(z=xy^2+x-1\), and \(z=2xy-1\).</p>

<p>We can write \(xy^2+x-1=2xy-1\). Eventually, this relationship becomes equivalent to \(x(y-1)^2\). But because \(x \neq 0 \Rightarrow y=1\).</p>

<p>If \(y=1\), then \(x=\frac{z+y}{2}\).</p>

<h2 id="answer-20">Answer 20.</h2>

<p>We pick a base \(d\) in the interval of \(a,b,c\). Basically we as for Problem 18.</p>

<p>After we do the substitution, we need to prove:</p>

\[\frac{y+z}{x} + \frac{z+x}{y} + \frac{x+y}{z} \ge \frac{4x}{y+z} + \frac{4y}{z+x} + \frac{4z}{x+y}.\]

<p>Then, we need to prove that inequality holds true for:</p>

\[\frac{y+z}{x} \ge \frac{4x}{y+z}\]

<p>Which is easy to prove using AM-GM inequality.</p>


guid: /2024/03/14/a-surprising-matrix-problem
title: A surprising matrix problem
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/03/14/a-surprising-matrix-problem
feedurl: https://www.andreinc.net/feed.xml
base: /2024/03/14/a-surprising-matrix-problem
content_mime_type: text/html
content:
<p>In this short article I will discuss a <em>cute</em> mathematical problem that I discovered while reading <a href="https://www.amazon.com/Polyas-Footsteps-Miscellaneous-Mathematical-Expositions/dp/0883853264">“Polya’s Footsteps: Miscellaneous Mathematical Expositions”</a> by the Canadian mathematician <a href="https://en.wikipedia.org/wiki/Ross_Honsberger">Ross Honsberger</a>. If you’re not familiar with Honsberger’s work, he is a well-known author in the field of <a href="https://en.wikipedia.org/wiki/Recreational_mathematics">recreational mathematics</a>. The one and only <a href="https://en.wikipedia.org/wiki/Edsger_W._Dijkstra">Edsger W. Dijkstra</a> referred to Honsberger’s work as “delightful”.</p>

<p>The problem was asked during the First Round of the Spanish Math Olympiad in 1988, and if you own the book, you can find it at page 9.</p>

<hr />

<p>The integers \(1,2,3,...,n^2\) are arranged to form the \(n \times n\) matrix:</p>

\[A=\begin{pmatrix} 
1 &amp; 2 &amp; ... &amp; n\\
n+1 &amp; n+2 &amp; ... &amp; 2n \\
... &amp; ... &amp; ... &amp; ... \\
(n-1)n+1 &amp; ... &amp; ... &amp; n^2
\end{pmatrix}\]

<p>A sum \(S_A\) is constructed as follows:</p>

<ul>
  <li>The first term \(x_1\) in \(S\) is chosen at random from the entries of \(A\);</li>
  <li>After selecting \(x_1\), \(x_1\)’s row and column are deleted.</li>
  <li>The second term \(x_2\) is chosen randomly from the remaining entries in \(A\), after which \(x_2\)’s row and column are deleted.</li>
  <li>We carry similar selections and deletions until \(A\) is exhausted.</li>
</ul>

<p>Prove that the sum \(S\) builds up to the exact total no matter what entries (\(x_1, x_2, ...\)) might be taken. So the sum \(S\) is always the same.</p>

<hr />

<p>Excellent problem, isn’t it?</p>

<p>The first thing I did was check and see how everything worked, so I started with a \(3 \times 3\) matrix:</p>

\[A=\begin{pmatrix} 
1 &amp; 2 &amp; 3 \\
4 &amp; 5 &amp; 6 \\
7 &amp; 8 &amp; 9 \\
\end{pmatrix}\]

<p>I randomly selected \(3\), then removed its row and column. The matrix \(A\) becomes: \(\begin{pmatrix} 4 &amp; 5 \\ 7 &amp; 8 \end{pmatrix}\). Then I randomly selected \(7\), removed its row and column, so that \(A\) becomes \(A=\begin{pmatrix} 5 \end{pmatrix}\). On this run the sum \(S_A=3+7+5=15\).</p>

<p>I did try a second run \(S_A=5+1+9\), and a third run \(S_A=6+2+7\).</p>

<p>For a \(3 \times 3\) matrix, the sum is \(S_A=15\), no matter what we do.</p>

<p>At this point, it’s worth noting that if we examin things from a column perspective, each time we select numbers from a different column. Similarly, if we look at it from a row perspective, each time we select a number from a different row than the previous ones.</p>

<p>So, the intuition says there’s something to do with the positions of the numbers and not the numbers themselves. That would be incorrect, but it led me in the right direction.</p>

<p>For example, if we pick a matrix \(B\) that’s <em>slightly different</em> than \(A\), and comes in the form:</p>

\[B=\begin{pmatrix} 
1 &amp; 2 &amp; 3 &amp; ... &amp; n \\
1 &amp; 2 &amp; 3 &amp; ... &amp; n \\
... &amp; ... &amp; ... &amp; ... &amp; ... \\
1 &amp; 2 &amp; 3 &amp; ... &amp; n \\
\end{pmatrix}\]

<p>If we apply the the same algorithm to \(B\), our sum will always be:</p>

\[S_B=1+2+3+...+n=\frac{n(n+1)}{2}\]

<p>The reason is simple: before we exhaust matrix \(B\), we visit all the possible columns without repetition. Of course, the order can differ, but the sum remains the same (addition is commutative).</p>

<p>So, half of the problem is solved. We know that the sum is constant for a matrix \(B\). We need to find a relationship between the terms of \(B\) and \(A\) and show that something similar is happening for \(A\).</p>

<p>The relationship between the two matrices is the following:</p>
<ul>
  <li>Each term from the first row of \(A\) is identical to its corresponding term on the first row of \(B\);</li>
  <li>Each term from the second row of \(A\) is \(n\) more than its corresponding term on the second row of \(B\);</li>
  <li>Each term from the third row of \(A\) is \(2*n\) more than its corresponding term on the third row of \(B\);</li>
</ul>

<p>We can generalize:</p>
<ul>
  <li>Each term on the k<sup>th</sup> row of \(A\) is \(k*n\) more than its corresponding term on the k<sup>th</sup> row of \(B\).</li>
</ul>

<p>So if consider \(a_1, a_2, ..., a_n\) the chosen elements from \(S_A\) and the corresponding \(b_1, b_2, ..., b_n\) from \(S_B\), we see the following pattern:</p>

<ul>
  <li>\(a_1 = b_1\) ;</li>
  <li>\(a_2 = b_2 + n\) ;</li>
  <li>\(a_3 = b_3 + 2*n\) ;</li>
  <li>\(a_4 = b_4 + 3*n\) ;</li>
  <li>… and so on</li>
</ul>

<p>If we sum \(S_A = a_1 + a_2 + ... + a_n\) we obtain:</p>

\[S_A = (b_1+0*n) + (b_2 + n) + (b_3 + 2*n) + ... + (b_n + (n-1)*n) \Leftrightarrow \\ 
S_A = S_B + n(1+2+3...+(n-1)) \Leftrightarrow \\
S_A = \frac{n(n+1)}{2} + n*\frac{n(n-1)}{2} \Leftrightarrow \\
S_A = \frac{n(n^2+1)}{2} \\\]

<p>So \(S_A\) is a constant that depends on \(n\).</p>

<p>This explains why the result was always 15 for the \(3 \times 3\) matrix we’ve picked.</p>

<hr />

<h4 id="personal-observation-an-exercise-left-for-the-reader">Personal observation, an exercise left for the reader</h4>

<p>If you give the problem some thought, you will see that the problem holds not only for consecutive numbers but for all the numbers in arithmetical progression.</p>

<p>So, as long as the matrix \(A\) is in this form:</p>

\[A=\begin{pmatrix} 
a_1 &amp; a_2 &amp; a_3 &amp; ... &amp; a_n \\
a_{n+1} &amp; ... &amp; ... &amp; ... &amp; a_{2n} \\
... &amp; ... &amp; ... &amp; ... &amp; ... \\
... &amp; ... &amp; ... &amp; ... &amp; a_{n^2} \\
\end{pmatrix}\]

<p>And \(a_1, a_2, ..., a_{n^2}\) are in arithmetic progression, so that \(a_k=a_{k-1}+d\), and is \(d\) is the common difference, the sum \(S_A\) (as previously defined) is constant.</p>

<p>If we pick a \(3 \times 3\) example of a matrix \(A\) with numbers in an arithmetical progression:</p>

\[A=\begin{pmatrix} 
1 &amp; 3 &amp; 5 \\
7 &amp; 9 &amp; 11 \\
13 &amp; 15 &amp; 17
\end{pmatrix}\]

<p>We observe that the sum, \(S_A\), is constant: \(S_A^1=1+9+17\), \(S_A^2=5+9+13\), etc. They are all 27.</p>

<p>Proving this is an exercise left for the reader.</p>


guid: /2024/03/25/10-algebra-problems-part-2
title: 10 algebra problems selected from the Romanian Olympiad (Part 2)
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/03/25/10-algebra-problems-part-2
feedurl: https://www.andreinc.net/feed.xml
base: /2024/03/25/10-algebra-problems-part-2
content_mime_type: text/html
content:
<h1 id="intro">Intro</h1>

<p>This article is a continuation of <a href="/2024/02/23/20-algebra-problems-part-1">my previous selection</a> of non-trivial algebra problems from the Romanian Math Olympiad for high-school students. However, this time I have included a few harder problems from the National Phase that would definitely provide a challenge to any reader.</p>

<p>Personally, I found problems <strong>5.</strong> and <strong>9.</strong> to be the most difficult.</p>

<h1 id="the-problems">The Problems</h1>

<hr />

<p><strong>1.</strong> <sup><sup>easy</sup></sup> Find \(m, n \in \mathbb{Z}\) if:</p>

\[9m^2+3n=n^2+8\]

<p><sup><sup><a href="#hint-1">Hint</a> &amp;  <a href="#answer-1">Answer</a></sup></sup></p>

<hr />

<p><strong>2.</strong> <sup><sup>easy</sup></sup> Find \(x,y,z \in \mathbb{R_{+}^{*}}\) if:</p>

\[\begin{cases}
x^3y+3 \le 4z \\
y^3z+3 \le 4x \\
z^3x+3 \le 4y
\end{cases}\]

<p><sup><sup><a href="#hint-2">Hint</a> &amp;  <a href="#answer-2">Answer</a></sup></sup></p>

<hr />

<p><strong>3.</strong> <sup><sup>easy</sup></sup> Find \(x \notin \mathbb{Q}\) so that:</p>

\[x^2+2x \in \mathbb{Q}\]

\[x^3-6x \in \mathbb{Q}\]

<p><sup><sup><a href="#hint-3">Hint</a> &amp;  <a href="#answer-3">Answer</a></sup></sup></p>

<hr />

<p><strong>4.</strong>  <sup><sup>easy</sup></sup> If \(a, b \in \mathbb{C}\) prove:</p>

\[\lvert 1 + ab \rvert + \lvert a+b \rvert \ge \sqrt{\lvert a^2 - 1 \rvert * \lvert b^2 - 1 \rvert}\]

<hr />

<p><sup><sup><a href="#hint-4">Hint</a> &amp;  <a href="#answer-4">Answer</a></sup></sup></p>

<p><strong>5.</strong> <sup><sup>hard</sup></sup> Find \(a, b \in \mathbb{R}\), if \(a+b \in \mathbb{Z}\) and \(a^2+b^2=2\).</p>

<p><sup><sup><a href="#hint-5">Hint</a> &amp;  <a href="#answer-5">Answer</a></sup></sup></p>

<hr />

<p><strong>6.</strong> <sup><sup>easy</sup></sup> Find all numbers \(n \in \mathbb{N}\) with the following property: \(\exists  (a,b) \in \mathbb{Z}\) so that \(n^2=a+b\), and \(n^3=a^2+b^2\).</p>

<p><sup><sup><a href="#hint-6">Hint</a> &amp;  <a href="#answer-6">Answer</a></sup></sup></p>

<hr />

<p><strong>7.</strong> <sup><sup>easy</sup></sup> Prove the following inequality:</p>

\[\frac{a}{x}+\frac{b}{y} \ge \frac{4(ay+bx)}{(x+y)^2}\]

\[\forall a,b,x,y \gt 0\]

<p><sup><sup><a href="#hint-7">Hint</a> &amp;  <a href="#answer-7">Answer</a></sup></sup></p>

<hr />

<p><strong>8.</strong> <sup><sup>medium</sup></sup> Prove the following inequality:</p>

\[\frac{a}{b+2c+d}+\frac{b}{c+2d+a}+\frac{c}{d+2a+b}+\frac{d}{a+2b+c} \ge 1\]

\[\forall a,b,c,d \gt 0\]

<p><sup><sup><a href="#hint-8">Hint</a> &amp;  <a href="#answer-8">Answer</a></sup></sup></p>

<hr />

<p><strong>9.</strong> <sup><sup>hard</sup></sup> If \(x_1, x_2, ..., x_n\) are strictly positive numbers prove the following:</p>

\[\frac{1}{1+x_1}+\frac{1}{1+x_1+x_2}+...+\frac{1}{1+x_1+x_2+...+x_n} \lt \sqrt{\frac{1}{x_1}+\frac{1}{x_2}+...+\frac{1}{x_n}}\]

<p><sup><sup><a href="#hint-9">Hint</a> &amp;  <a href="#answer-9">Answer</a></sup></sup></p>

<hr />

<p><strong>10.</strong> <sup><sup>medium</sup></sup> If \(x,y \in \mathbb{N}^{*}\), \(x \neq y\). Prove that:</p>

\[\frac{(x+y)^2}{x^3+xy^2-x^2y-y^3} \notin \mathbb{Z}\]

<p><sup><sup><a href="#answer-10">Answer</a></sup></sup></p>

<h1 id="hints">Hints</h1>

<h2 id="hint-1">Hint 1.</h2>

<p>Try to find a way to write the expression as a product between two numbers.</p>

<h2 id="hint-2">Hint 2.</h2>

<p>Even if not obvious, the key to elegantly solving the problem is to use the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>.</p>

<h2 id="hint-3">Hint 3.</h2>

<p>Try to express \(x^3-6x\) in terms of \(x^2+2x\).</p>

<h2 id="hint-4">Hint 4.</h2>

<p>Did you know that \(\lvert a + b \rvert \le \lvert a \rvert + \lvert b \rvert\) ?</p>

<h2 id="hint-5">Hint 5.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>?</p>

<h2 id="hint-6">Hint 6.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>?</p>

<h2 id="hint-7">Hint 7.</h2>

<p>Can you use the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>?</p>

<h2 id="hint-8">Hint 8.</h2>

<p>Can you please problem 7. ?</p>

<h2 id="hint-9">Hint 9.</h2>

<p>The key to solving this problem is the <a href="https://en.wikipedia.org/wiki/Cauchy-Schwarz_inequality">CBS Inequality</a>. Unfortunately the solution is much more subtle than anticipated, so don’t be upset if you don’t see it.</p>

<h1 id="answers">Answers</h1>

<h2 id="answer-1">Answer 1.</h2>

<p>\(0\), \(1\), small and prime numbers are our friends, so if we can find an expression like</p>

\[(m-\text{something})(n-{something}) = 0 \text{ (or a prime number)}\]

<p>, we would already have put a powerful constraint on the nature of \(m\) and \(n\).</p>

<p>Our expression is:</p>

\[9m^2+3n=n^2+8\]

<p>If we move all the terms involving \(m\) and \(n\) on the left side:</p>

\[9m^2+3n-n^2=8\]

<p>Now let’s multiply each side with \(4\):</p>

\[36m^2-4n^2+12n=32\]

<p>And, then write the expression as the difference between two square numbers:</p>

\[36m^2 - (2^2*n^2-2*2n*3+3^2)=23\]

<p>Our initial expression becomes:</p>

\[[6^2m^2 - (2n^2-3)^2]=23 \Leftrightarrow \\
(6m-2n+3)(6m+2n-3)=1*23\]

<p>So there are a few possibilities:</p>

\[\begin{cases}
6m-2n+3=23 \\
6m+2n-3=1
\end{cases}\]

<p>Or:</p>

\[\begin{cases}
6m-2n+3=1 \\
6m+2n-3=23
\end{cases}\]

<p>Or:</p>

\[\begin{cases}
6m-2n+3=-1 \\
6m+2n-3=-23
\end{cases}\]

<p>If we sum \(6m-2n+3+(6m+2n-3)=\pm 24 \Rightarrow m=\pm 2\)</p>

<p>If we substitute \(m=\pm 2\) back into the initial relationship, we will obtain the values of \(n\).</p>

<p>The solutions are:  \((2,7), (-2,7), (2, -4), (-2, -4)\).</p>

<h2 id="answer-2">Answer 2.</h2>

<p>This problem is beautiful; honestly, I had to look for some hints before solving it.</p>

<p>Intuitively, we observe the obvious \(x=y=z=1\) solution. But what if there are more?</p>

\[\begin{cases}
x^3y+3 \le 4z \\
y^3z+3 \le 4x \\
z^3x+3 \le 4y
\end{cases}\]

<p>Becomes:</p>

\[\begin{cases}
x^3y  \le 4z - 3 \\
y^3z  \le 4x - 3\\
z^3x  \le 4y - 3
\end{cases}\]

<p>Because \(x,y,z \in \mathbb{R_{+}^{*}}\) (a significant detail), we can multiply all our three inequalities to obtain:</p>

\[x^4y^4z^4 \le (4x-3)(4y-3)(4z-3)\]

<p>And now, the <em>subtle idea</em>. According to <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>, it is obvious:</p>

\[\frac{x^4+1^4}{2} \ge \sqrt{x^4*1^4} \Rightarrow \\
x^4+1 \ge 2x^2 \Rightarrow \\
x^4+3 \ge 2(x^2+1)\]

<p>By applying the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM</a>, it is known:</p>

\[x^2+1 \ge 2*\sqrt{x^2*1^2} \Rightarrow \\
2(x^2+1) \ge 4x\]

<p>So we can conclude that:</p>

\[x^4+3 \ge 4x \Rightarrow
x^4 \ge 4x-3\]

<p>The equality holds if \(x=1\).</p>

<p>Similarly, we obtain:</p>

\[\begin{cases}
x^4  \ge 4x - 3 \\
y^4  \ge 4y - 3\\
z^4  \ge 4z - 3
\end{cases}\]

<p>If we multiply all three inequalities, we will obtain:</p>

\[x^4y^4z^4 \ge (4x-3)(4y-3)(4z-3)\]

<p>So now we have two inequalities:</p>

\[\begin{cases}
x^4y^4z^4 \le (4x-3)(4y-3)(4z-3) \\
x^4y^4z^4 \ge (4x-3)(4y-3)(4z-3)
\end{cases}\]

<p>Isn’t it ironic? Because of the opposite signs of the two inequalities, they only happen when equality happens.</p>

<p>So we can now conclude that \(x=y=z=1\).</p>

<h2 id="answer-3">Answer 3.</h2>

<p>Let’s introduce \(a\) and \(b\), so that \(a=x^2+2x \in \mathbb{Q}\) and \(b=x^3-6x \in \mathbb{Q}\).</p>

<p>Now we will try to express \(b\) in terms of \(a\) and \(x\):</p>

\[b=x^3+2x^2-2x^2-4x-2x \Leftrightarrow \\
b=x(x^2+2x)-2(x^2+2x)-2x \Leftrightarrow \\
b=x*a-2a-2x \Leftrightarrow \\
b=x(a-2)-2a\]

<p>But \(b \in Q\) and \(x \notin Q\), then \(a-2=0\), and \(b=-2a\).</p>

<p>If \(a-2=0 \Rightarrow a=2\), then \(x^2+2x-2=0\). We solve this equation, by finding \(\Delta=12\), with the final solutions for \(x\):</p>

\[x=\frac{-2 \pm 2\sqrt{3}}{2} =-1 \pm \sqrt{3}\]

<h2 id="answer-4">Answer 4.</h2>

<p>For this, we need to apply the following fundamental inequality:</p>

\[\lvert 1 + ab \rvert + \lvert a + b \rvert \ge \lvert 1 + ab + a +  b \rvert \\
\lvert 1 + ab \rvert - \lvert a + b \rvert \ge \lvert 1 + ab - a -  b \rvert \\\]

<p>If we multiply both inequalities, the problem is solved:</p>

\[(\lvert 1 + ab \rvert + \lvert a + b \rvert)^2 \ge \lvert 1 + ab + a +  b \rvert * \lvert 1 + ab - a -  b \rvert \Leftrightarrow \\
\lvert 1 + ab \rvert + \lvert a + b \rvert \ge \sqrt{\lvert a^2 - 1 \rvert * \lvert b^2 - 1 \rvert}\]

<h2 id="answer-5">Answer 5.</h2>

<p>We need a way to link \(a+b\) and \(a^2+b^2\).</p>

<p>If we look at the <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>, we shall see that:</p>

\[\frac{x_1+x_2+...+x_n}{n} \le \sqrt{\frac{x_1^2+x_2^2+...+x_n^2}{n}}\]

<p>For us, this means:</p>

\[\frac{a+b}{2} \le \sqrt{\frac{a^2+b^2}{2}} \Leftrightarrow \\
(a+b)^2 \le 2(a^2+b^2) \Leftrightarrow \\
(a+b)^2 \le 4 \Leftrightarrow \\
\lvert a + b \rvert \le 2\]

<p>Luckily for us, \(a+b \in \mathbb{Z}\) so we can conclude that \(a+b \in \{-2,-1,0,1,2\}\).</p>

<p>Now, let’s try to <em>create</em> a second-degree equation in \(a\):</p>

\[a^2+b^2=2 \Leftrightarrow \\ 
a^2+b^2+2ab-2ab+2a^2-2a^2=2 \Leftrightarrow \\
2a^2 + (a+b)^2 - 2a(a+b)=2\]

<p>I think this trick is the hardest to think of. This type of intuition comes after lots of solved exercises. So don’t be upset if you haven’t spotted this.</p>

<p>If we substitute \(m=a+b\), our equation becomes:</p>

\[2a^2 - 2am + m^2-2=0\]

<p>We need to find all the possible values of \(a\) for all the possible values of \(m\).</p>

<p>For example, if we pick the possible value \(m=-2\), our equation becomes \(2a^2 + 4a + 2 = 0\). The solution is \(a=-1 \Rightarrow b=-1\).</p>

<p>If we substitute all values of \(m\), we will find all of our solutions:</p>

\[(-1,-1), (1,1), (\frac{1+\sqrt{3}}{2}, \frac{1-\sqrt{3}}{2}), \text{ ... and so on}\]

<h2 id="answer-6">Answer 6.</h2>

<p>Because of <a href="https://en.wikipedia.org/wiki/QM-AM-GM-HM_inequalities">QM-AM-GM-HM inequalities</a>, we know that:</p>

\[2(a^2+b^2) \ge (a+b)^2\]

<p>This relationship leads to the simple conclusion:</p>

\[2*n^3 \ge n^4\]

<p>But because \(n \in \mathbb{N}\) the only possible values for \(n\) are \(n \in \{0,1,2\}\).</p>

<p>If \(n=0\) then \(a=0\) and \(b=0\).</p>

<p>If \(n=1\) then \(a=1\) and \(b=0\).</p>

<p>If \(n=2\) then \(a=2\) and \(b=2\).</p>

<h2 id="answer-7">Answer 7.</h2>

<p>This one is simple:</p>

\[\frac{a}{x} + \frac{b}{y} \ge \frac{4(ay+bx)}{(x+y)^2}\]

<p>Becomes:</p>

\[\frac{ay+bx}{xy} \ge \frac{4(ay+bx)}{(x+y)^2} \Leftrightarrow \\
\frac{1}{xy} \ge \frac{4}{(x+y)^2} \Leftrightarrow \\
\frac{(x+y)^2}{2^2} \ge xy \Leftrightarrow \\
\frac{x+y}{2} \ge \sqrt{xy}\]

<h2 id="answer-8">Answer 8.</h2>

<p>This exercise would be much more laborious without using Problem 7.</p>

<p>But we already know from the previous answer that \(\frac{a}{x}+\frac{b}{y} \ge \frac{4(ay+bx)}{(x+y)^2}\), \(\forall a,b,x,y \gt 0\).</p>

<p>So, let’s re-group wisely our terms:</p>

\[\frac{a}{\underbrace{b+2c+d}_{x}}+\frac{c}{\underbrace{d+2a+b}_{y}}+\frac{b}{c+2d+a}+\frac{d}{a+2b+c} \ge 1 \Leftrightarrow\]

<p>Because of the previous problem, we know that:</p>

\[\frac{a}{\underbrace{b+2c+d}_{x}}+\frac{c}{\underbrace{d+2a+b}_{y}} \ge \frac{ 4(a(d+2a+b) + c(b+2c+d)) }{(2a+2b+2c+2d)^2}\]

<p>This can be further simplified to:</p>

\[\frac{a}{\underbrace{b+2c+d}_{x}}+\frac{c}{\underbrace{d+2a+b}_{y}} \ge \frac{2a^2+2d^2+ab+bc+cd+da}{(a+b+c+d)^2} \text{ (*)}\]

<p>In a similar fashion:</p>

\[\frac{b}{c+2d+a}+\frac{d}{a+2b+c} \ge \frac{2b^2+2d^2+ab+bc+cd+da}{(a+b+c+d)^2} \text{ (**)}\]

<p>If we sum \(\text{(*)}\) and \(\text{(**)}\):</p>

\[\frac{a}{b+2c+d}+\frac{c}{d+2a+b}+\frac{b}{c+2d+a}+\frac{d}{a+2b+c} \ge  \\
\ge \frac{2a^2+2d^2+ab+bc+cd+da+2b^2+2d^2+ab+bc+cd+da}{(a+b+c+d)^2}\]

<p>But we know that \((a+b+c+d)^2=a^2+b^2+c^2+d^2+2(ab+ac+ad+bc+bd+cd)\).</p>

<p>So, with enough patience, we can group things in the previous fraction as follows:</p>

\[\frac{a}{b+2c+d}+\frac{c}{d+2a+b}+\frac{b}{c+2d+a}+\frac{d}{a+2b+c} \ge \frac{(a+b+c+d)^2+(a-c)^2+(b-d)^2}{(a+b+c+d)^2} \\\]

<p>Eventually, we would obtain something like this:</p>

\[1+\frac{(a-c)^2+(b-d)^2}{(a+b+c+d)^2} \ge 1\]

<p>The last relationship is obviously true, \(\forall a,b,c,d \gt 0\).</p>

<h2 id="answer-9">Answer 9.</h2>

<p>This is by no means an easy problem. Of course, once you see the solution, it doesn’t look that hard, but coming up with the idea in the first place is more complicated.</p>

<p>We do the following notation(s):</p>

\[\begin{cases}
s_1=x_1 \\
s_2=x_2+x_1 \\
s_3=x_3+x_2+x_1 \\
\text{...} \\
s_n=x_n+x_{n-1}+...+x_1
\end{cases}\]

<p>Because \(x_1, x_2, ..., x_n\) are strictly positive we can conclude that \(s_1 \lt s_2 \lt s_3 ... \lt s_n\).</p>

<p>Another important aspect is the fact:</p>

<p>\(x_k=s_k-s_{k-1}\), \(\forall k \in N\).</p>

<p>With this in mind, we can re-write everything as:</p>

\[\frac{1}{1+s_1}+\frac{1}{1+s_2}+...\frac{1}{1+s_n} \le \sqrt{\frac{1}{s_1}+\frac{1}{s_2-s_1}+...+\frac{1}{s_n-s_{n-1}}}\]

<p>The above relationship is the equivalent inequality we need to prove.</p>

<p>Now, we can write each term from the right side, \(\frac{1}{1+s_k}\), as a product:</p>

\[\frac{1}{1+s_1}=\frac{1}{\sqrt{s_1}}*\frac{\sqrt{s_1}}{1+s_1}\]

\[\frac{1}{1+s_k}=\frac{1}{\sqrt{s_k-s_{k-1}}}*\frac{\sqrt{s_k-s_{k-1}}}{1+s_k}\]

<p>According to <a href="https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality">CBS inequality</a> we know the following is true:</p>

\[(\frac{1}{1+s_1}+...+\frac{1}{1+s_n})^2 \lt (\frac{1}{s_1}+\frac{1}{s_2-s_1}+...+\frac{1}{s_n-s_{n-1}})(\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2})\]

<p>We can safely square root everything to obtain:</p>

\[\frac{1}{1+s_1}+...+\frac{1}{1+s_n} \lt \sqrt{(\frac{1}{s_1}+\frac{1}{s_2-s_1}+...+\frac{1}{s_n-s_{n-1}})}*\sqrt{(\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2})}\]

<p>We are almost there.</p>

<p>If we somehow manage to prove that: \(\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2} \le 1\), the problem is solved.</p>

<p>But remember \(s_1 \lt s_2 \lt ... \lt s_n\), so we can safely say:</p>

\[\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2} \le \frac{s_1}{(1+s_1)} + \frac{s_2-s_1}{(1+s_1)(1+s_2)}+...+\frac{s_n-s_{n-1}}{(1+s_{n-1})(1+s_{n})}\]

<p>This becomes:</p>

\[\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2} \lt 1 - \frac{1}{1+s_1} + \frac{1}{1+s_1} -...-\frac{1}{1+s_n}\]

<p>Eventually, after reducing the terms one by one:</p>

\[\frac{s_1}{(1+s_1)^2}+\frac{s_2-s_1}{(1+s_2)^2}+...+\frac{s_n-s_{n-1}}{(1+s_n)^2} \lt 1 - \frac{1}{1+s_n} \lt 1\]

<p>At this point, everything is proven.</p>

<h2 id="answer-10">Answer 10.</h2>

<p>We can write our relationship as:</p>

\[m=\frac{(x+y)^2}{x^3+xy^2-x^2y-y^3} = \frac{(x+y)^2}{(x-y)(x^2+y^2)}.\]

<p>Let’s suppose the opposite and affirm that \(m \in \mathbb{Z}\).</p>

<p>If \(m \in \mathbb{Z}\), then \(\frac{(x+y)^2}{x^2+y^2} \in \mathbb{Z}\).</p>

<p>But we can write the fraction as:</p>

\[\frac{(x+y)^2}{x^2+y^2} = 1 + \frac{2xy}{x^2+y^2} \in \mathbb{Z}\]

<p>Then \(\frac{2xy}{x^2+y^2}\) must be an integer.</p>

<p>But we know for certain that \(x^2+y^2 \gt 2xy \Rightarrow 0 \lt \frac{2xy}{x^2+y^2} \lt 1\), but this is a contradiction.</p>


guid: /2024/03/28/programming-projects-ideas
title: My list of challenging software projects some programmers should try
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/03/28/programming-projects-ideas
feedurl: https://www.andreinc.net/feed.xml
base: /2024/03/28/programming-projects-ideas
content_mime_type: text/html
content:
<p>Before we begin, I’d like to clarify that the project ideas I am about to suggest are mainly intended for those who are interested in exploring new areas of knowledge. However, it’s important to note that most of these ideas may not be relevant to today’s job market. If you’re looking to add something impressive to your portfolio for recruitment purposes, it might be worth considering other options. For example, instead of building yet another TODO app in React (75k repos on GitHub), you might want to focus on back-end or front-end development by cloning a well-known site. Such projects are likely to be more beneficial in terms of knowledge gained and job perspectives.</p>

<p>That said, some developers are more interested in exploring creative fields beyond the traditional job market. For these individuals, programming is more of a hobby than a means of earning a living. If you fall into this category, you may find the following project suggestions more appealing.</p>

<p>You can also check other articles on this topic:</p>
<ul>
  <li><a href="https://austinhenley.com/blog/challengingprojects.html">Challenging projects every programmer should try</a></li>
  <li><a href="https://austinhenley.com/blog/morechallengingprojects.html">More challenging projects every programmer should try</a></li>
  <li><a href="https://austinhenley.com/blog/morechallengingprojects.html">Challenging algorithms and data structures every programmer should try</a></li>
  <li><a href="https://jamesg.blog/2024/02/28/programming-projects/">(Even more) challenging programming projects you should try</a></li>
</ul>

<hr />

<h1 id="my-list">My list</h1>

<ul>
  <li><a href="#lesser-known-data-structures">Lesser Known Data Structures</a></li>
  <li><a href="#write-a-distributed-hash-table">Write a distributed Hash Table</a></li>
  <li><a href="#write-a-scientific-calculator">Write a <em>scientific</em> calculator</a></li>
  <li><a href="#write-your-own-http-server-in-c--posix">Write your own HTTP Server in C + POSIX</a></li>
  <li><a href="#write-an-esoteric-programming-language">Write an esoteric programming language</a></li>
  <li><a href="#write-your-own-virtual-machine">Write your own Virtual Machine</a></li>
  <li><a href="#write-a-game-for-uxn">Write a game for UXN </a></li>
  <li><a href="#write-a-game-for-tic-80">Write a game for TIC-80</a></li>
  <li><a href="#write-your-original-markdown-language">Write your original markdown language</a></li>
  <li><a href="#write-a-static-site-generator">Write a static site-generator</a></li>
  <li><a href="#mandelbrot-set-navigator">Mandelbrot Set Navigator</a></li>
  <li><a href="#simulate-various-phenomena-from-physics">Simulate various phenomena from physics</a></li>
  <li><a href="#experiment-with-conways-game-of-life">Experiment with Conway’s Game Of Life</a></li>
  <li><a href="#approximate-reality-with-polynomials">Approximate the reality with polynomials</a></li>
  <li><a href="#a-calculator-for-symbolic-differentiation">A calculator for symbolic differentiation</a></li>
  <li><a href="#a-slot-machine">A slot machine</a></li>
  <li><a href="#write-a-game-engine-for-text-based-games">Write a game engine for text-based adventures</a></li>
  <li><a href="#write-a-tiling-window-manager">A tiling window manager</a></li>
</ul>

<hr />

<h1 id="lesser-known-data-structures">Lesser Known Data Structures</h1>

<p>For example, <a href="https://austinhenley.com/">Austin Z. Henley</a> recommends writing your own <a href="https://en.wikipedia.org/wiki/Topological_sorting">Topological Sort</a>, <a href="https://en.wikipedia.org/wiki/Recursive_descent_parser">Recursive Descent Tree Parsing</a>, <a href="https://en.wikipedia.org/wiki/Bloom_filter">Bloom Filter</a>, <a href="https://en.wikipedia.org/wiki/Piece_table">Piece Table</a>, <a href="https://en.wikipedia.org/wiki/Splay_tree">Splay Tree</a> implementations.</p>

<p>The truth is that many Computer Science curricula have been diluted. In fact, some schools only teach the basics, such as Dynamic Arrays, Linked Lists, Queues, Stacks, and Hash Tables. However, there are many other Data Structures and Algorithms that are worth exploring beyond these fundamental concepts.</p>

<p>Personally, I would also go for:</p>

<ul>
  <li><a href="https://en.wikipedia.org/wiki/B-tree">B-Tree</a> - I would defintely implement this one. It’s an interesting data structure that is used in database systems or filesystems. It also opens you to new ways of thinking about improving your memory and data layout in your applications;</li>
  <li><a href="https://en.wikipedia.org/wiki/Circular_buffer">Circular Buffer</a> -  This is a data structure that solves the Consumer-Producer problem elegantly, especially when the Consumer cannot (momentarily) keep up with the Producer.</li>
  <li><a href="https://en.wikipedia.org/wiki/Cuckoo_filter">Cuckoo Filter</a> and <a href="https://en.wikipedia.org/wiki/Cuckoo_hashing">Cuckoo Hash Table</a> - The practicality of the <em>Cuckoo</em> approach is yet to be proven, but this is definitely something that’s worth your time for fun purposes. Simply put, the idea behind those data structures is fun and creative.</li>
  <li><a href="https://en.wikipedia.org/wiki/Open_addressing">Open-Addressing Hash Tables</a> - Most schools and courses focus on the Separate Chaining technique and blatantly ignore the elegant ways of <em>open addressing</em>. So why don’t you want write a few open-addressing implementations and benchmark them against existing library implementations? Try to make your implementation faster, brag, and learn.</li>
</ul>

<h1 id="write-a-distributed-hash-table">Write a distributed Hash Table</h1>

<p>If you already know how to write your own <em>Hash Table</em>, building a <a href="https://en.wikipedia.org/wiki/Distributed_hash_table"><em>Distributed Hash Table</em></a> won’t be an impossible task. Although it might seem like a complicated project, it doesn’t necessarily have to be <em>production-ready</em> or become the next Redis.</p>

<p>By the end of the project, you will likely become more comfortable with network programming and managing concurrency issues.</p>

<p>Bonus: Thoroughly testing your DHT will be a journey in itself.</p>

<p><sup>Don’t get demotivated if you get stuck or the result is terrible!</sup></p>

<hr />

<h1 id="write-a-scientific-calculator">Write a <em>scientific</em> calculator</h1>

<p>This is a relatively easy project, but it’s worth witnessing the power of the <em>Stack</em> data structure. You can do this by learning how to evaluate <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">RPN expressions</a> and implementing the <a href="https://en.wikipedia.org/wiki/Shunting_yard_algorithm">Shunting Yard algorithm</a>. As you work on this project, challenge yourself to learn a new GUI library, one that you haven’t touched before.</p>

<p>Once you have a working calculator, start exploring crazy ideas:</p>

<ol>
  <li>Implement your own <a href="https://androidcalculator.com/how-do-calculators-compute-sine/">sine function</a> just for the thrills.</li>
  <li>Implement your own big numbers library to operate on huge numbers.</li>
  <li>Can your calculator handle raising <code class="language-plaintext highlighter-rouge">3</code> to the power of <code class="language-plaintext highlighter-rouge">2.27</code>?</li>
  <li>Write a module that enables users to operate on matrices, including adding, multiplying, calculating the inverse, computing the determinant, and solving systems of linear equations, among other things.</li>
  <li>Can your calculator check if a number is prime?</li>
  <li>Can you write a module that gives the user random insights about numbers?</li>
</ol>

<p>It can also work in the <a href="http://numcalc.com/">browser</a>.</p>

<hr />

<h1 id="write-your-own-http-server-in-c--posix">Write your own HTTP Server in C + POSIX</h1>

<p><sup><em>First, start learning C if you haven’t already. Contrary to popular belief, learning C early in your career will make you a better programmer in the long-run. I am more convinced of this now than I ever was before. However, this is not the time or the article to support my claim.</em></sup></p>

<p>When implementing the HTTP protocol, keep in mind that you don’t have to cover everything. The purpose of this exercise is not to write the fastest HTTP server out there. Instead, you do it to:</p>

<ul>
  <li>Accumulate frustrations that come with dealing with <code class="language-plaintext highlighter-rouge">char*</code> frequently. Of course, you can create an abstraction over <code class="language-plaintext highlighter-rouge">char*</code> to solve this problem, and while it may be buggy, it will be uniquely yours!</li>
  <li>Learn about <code class="language-plaintext highlighter-rouge">fork()</code>, <code class="language-plaintext highlighter-rouge">pthreads</code>, and all the other low-level knowledge you don’t usually have to deal with, except in your Operating Systems course.</li>
  <li>Gain an understanding of how TCP and Networking Programming work.</li>
</ul>

<p>If mentioning C has offended you, you can always rewrite the project in Rust. That would be <em>new</em>.</p>

<hr />

<h1 id="write-an-esoteric-programming-language">Write an esoteric programming language</h1>

<p><sup><em>An esoteric programming language (sometimes shortened to esolang) is a programming language designed to test the boundaries of computer programming language design, as a proof of concept, as software art, as a hacking interface to another language (particularly functional programming or procedural programming languages), or as a joke. (<a href="https://en.wikipedia.org/wiki/Esoteric_programming_language">source</a>)</em></sup></p>

<p>This is a side project that lets you unleash your creativity. Here are some tips to help you get started:</p>

<ol>
  <li>Your language can have a simple grammar, so you don’t need to use <a href="https://en.wikipedia.org/wiki/Comparison_of_parser_generators">a parser generator</a>. Write the parser yourself. An <a href="https://en.wikipedia.org/wiki/APL_(programming_language)">APL</a>-like language with a limited set of <em>special graphic symbols</em> is not impossible to implement or parse.</li>
  <li>Have you heard of <a href="https://www.uiua.org/">UIUA</a> ?</li>
  <li>Altough it may seem like a long shot, take a look at <a href="https://www.reddit.com/r/tsevhu/comments/iserji/tsevhu_key_activity/">Tsevhu</a> and <a href="https://gammagames.itch.io/koilang">Koilang</a>. Tsevhu is not a programming language but a language in itself. Can you create similar with code?</li>
  <li>Speaking of Koilang, have you checked out <a href="https://www.dangermouse.net/esoteric/piet.html">piet</a>?</li>
  <li>It can also be a better joke than the <a href="https://esolangs.org/wiki/Albanian_Laundry_Machine">Albanian Laundry Machine</a>.</li>
</ol>

<p>For more inspiration, check the esolangs <a href="https://esolangs.org/wiki/Language_list">wiki</a>.</p>

<hr />

<h1 id="write-your-own-virtual-machine">Write your own Virtual Machine</h1>

<p>I’ve personally tackled this challenge (check this <a href="/2021/12/01/writing-a-simple-vm-in-less-than-125-lines-of-c">article</a>). However, I regret not designing an original set of instructions and instead implementing the <a href="https://en.wikipedia.org/wiki/Little_Computer_3">LC-3</a> instruction set.</p>

<p>Your project can be register-based, stack-based, or a hybrid. It can even have a JIT compiler if you are feeling brave.</p>

<p>Whatever you choose to do, the key is to be creative.</p>

<p>For instance, please look at <a href="https://100r.co/site/uxn.html">uxn</a>, which can run on multiple operating Systems or devices, and has a small community of dans writing <a href="https://github.com/hundredrabbits/awesome-uxn#applications">software for it</a>. Even <a href="https://www.twitch.tv/tsoding">tsoding</a>, one of my favourite Tech Youtubers, recently <a href="https://www.youtube.com/watch?v=rTb6NFKUmQU">implemented Conway’s Game Of Life as an uxn program</a>.</p>

<hr />

<h1 id="write-a-game-for-uxn">Write a game for UXN</h1>

<p>Firstly, understand how <a href="https://100r.co/site/uxn.html">uxn</a> works by reading the official documentation or by following <a href="https://compudanzas.net/uxn_tutorial.html">this excellent tutorial</a>.</p>

<p>Look at existing examples:</p>
<ul>
  <li><a href="https://github.com/keijiro/uxn-sketches/blob/main/flappy.tal">flappy bird</a></li>
  <li><a href="https://git.sr.ht/~rabbits/uxn/tree/main/item/projects/examples/demos/snake.tal">snake</a></li>
</ul>

<p>Come up with an original game idea.</p>

<p>Everyone seems to prefer Snake, Tetris, Pong, and Space Invaders. But there are other (now forgotten) games that deserve your attention.</p>

<p>Why don’t you try implementing something different:</p>
<ul>
  <li><a href="https://www.retrogames.cz/play_1653-DOS.php">Volfied</a>;</li>
  <li><a href="https://www.retrogames.cz/play_023-NES.php">Q*Bert</a>;</li>
  <li><a href="https://www.gamesdatabase.org/game/sinclair-zx-spectrum/jumping-jack">Jumping Jack</a></li>
</ul>

<hr />

<h1 id="write-a-game-for-tic-80">Write a game for TIC-80</h1>

<p><a href="https://tic80.com/">TIC-80</a> is a fantasy computer for making, playing, and sharing tiny games.</p>

<p>If you don’t know what game to write, take inspiration from <a href="https://tic80.com/play">here</a>.</p>

<p>This is more of an artistic project than a programming one, but still.</p>

<hr />

<h1 id="write-your-original-markdown-language">Write your original markdown language</h1>

<ol>
  <li>
    <p>Write a markdown language that is not precisely markdown but something alien.</p>
  </li>
  <li>
    <p>Extend an existing markdown implementation. You can get inspiration from <a href="https://liascript.github.io/">LiaScript</a> or <a href="https://rmarkdown.rstudio.com/">R Markdown</a>.</p>
  </li>
</ol>

<hr />

<h1 id="write-a-static-site-generator">Write a static site-generator</h1>

<p>Yes, it’s boring, but something needs to use the newly invented markdown language.</p>

<hr />

<h1 id="mandelbrot-set-navigator">Mandelbrot Set Navigator</h1>

<p>You don’t have to be <a href="https://www.youtube.com/watch?v=5qXSeNKXNPQ">Arthur C. Clarke</a> or a mathematican to appreciate the useless beauty of the <a href="https://en.wikipedia.org/wiki/Mandelbrot_set">Mandelbrot Set</a>.</p>

<p>Have you ever considered building your own Mandelbrot Set Explorer using HTML Canvas? There are plenty of examples on the internet:</p>
<ul>
  <li><a href="https://mandelbrot.site/">https://mandelbrot.site/</a></li>
  <li><a href="https://mandelbrot.silversky.dev/">https://mandelbrot.silversky.dev/</a></li>
  <li><a href="https://mandelbrotandco.com/en.hub169.html">https://mandelbrotandco.com/en.hub169.html</a></li>
  <li><a href="https://mandelbrot.page/">https://mandelbrot.page/</a></li>
  <li><a href="https://mandelbrot.jayvv.com/">https://mandelbrot.jayvv.com/</a></li>
</ul>

<p>Add a creative touch! For example:</p>
<ul>
  <li>To make your Mandelbrot Set Navigator unique, you can incorporate an intelligent coordinate system to help you navigate through infinity.</li>
  <li>Additionally, you can add a bookmark feature so you can save and revisit interesting patterns that you discover during your exploration. For instance, if you stumble upon the <a href="https://math.stackexchange.com/questions/2979906/are-there-any-unique-places-in-the-mandelbrot-set-that-have-not-yet-been-seen-gr">Elephant Valley</a>, you can bookmark the location for future reference and easily share it with others.</li>
</ul>

<hr />

<h1 id="simulate-various-phenomena-from-physics">Simulate various phenomena from physics</h1>

<p>Start with optics; it might be easier, and there are tons of examples on the internet:</p>
<ul>
  <li><a href="https://www.oeabt.com/en/dome/">https://www.oeabt.com/en/dome/</a></li>
  <li><a href="https://phet.colorado.edu/sims/html/geometric-optics/latest/geometric-optics_en.html">https://phet.colorado.edu/sims/html/geometric-optics/latest/geometric-optics_en.html</a></li>
</ul>

<p>If you understand what you are doing, jump to other areas:</p>
<ul>
  <li><a href="https://github.com/cselab/aphros?tab=readme-ov-file">https://github.com/cselab/aphros?tab=readme-ov-file</a></li>
</ul>

<p>Start small and slowly become <a href="https://ciechanow.ski/">Bartosz Ciechanowski</a>.</p>

<hr />

<h1 id="experiment-with-conways-game-of-life">Experiment with Conway’s Game Of Life</h1>

<p>I suppose you are already familiar with <a href="https://en.wikipedia.org/wiki/Conway's_Game_of_Life">Conway’s Game Of Life</a>.</p>

<p>Make something creative out of it:</p>
<ul>
  <li>Change the rules, add more states, add colors, emoticons and animations;</li>
  <li>Put the cells in a labyrinth, add portals, let the cells teleport;</li>
  <li>Write a slot machine that’s powered this cellular automaton;</li>
  <li>Interfere with the cells in real-time, see how they react, throw them some meat;</li>
</ul>

<p>There’s so much you can do.</p>

<hr />

<h1 id="approximate-reality-with-polynomials">Approximate reality with polynomials</h1>

<p>If you’ve studied computer graphics, you might’ve encountered the concept of <a href="https://en.wikipedia.org/wiki/B%C3%A9zier_curve">Bezier Curves</a>. Why don’t you start approximating <em>reality</em> with them?</p>

<p>Some fans of <a href="https://en.wikipedia.org/wiki/Pierre_B%C3%A9zier">Pierre Bezier</a> and <a href="https://en.wikipedia.org/wiki/Jamiroquai">Jamiroquai</a> have already played this game:</p>
<ul>
  <li><a href="https://www.youtube.com/watch?v=P2kkBtmozr4">Virtual Insanity but, it’s in Desmos Graphing Calculator</a>;</li>
  <li><a href="https://www.youtube.com/watch?v=zGlZqDHqhR0">Virtual Insanity but, it’s played on an oscilloscope</a>.</li>
  <li><a href="https://github.com/kevinjycui/DesmosBezierRenderer">Desmos Bezier Renderer</a></li>
</ul>

<p>Maybe now it’s your time to write a different renderer.</p>

<p>Why don’t you pick sines and cosines instead of polynomials? I hope you see where <a href="https://www.youtube.com/watch?v=-qgreAUpPwM">I am going</a>.</p>

<hr />

<h1 id="a-calculator-for-symbolic-differentiation">A calculator for symbolic differentiation</h1>

<p><sup>To understand what I am referring to, check this question on <a href="https://stackoverflow.com/questions/43455320/difference-between-symbolic-differentiation-and-automatic-differentiation">StackOverflow</a>.</sup></p>

<p>This is going to be a challenging project, but not as hard as you would imagine. Basically, you need to come up with something WolframAlpha is <a href="https://www.wolframalpha.com/input?i=derivative++x%5E2*cos%28x-7%29%2F%28sin%28x%29%29">already capable of</a>.</p>

<p>You will have to be able to parse mathematical expressions. Then, you will have to (recursively) apply specific rules for differentiation (e.g. the <a href="https://en.wikipedia.org/wiki/Chain_rule">chain</a> and <a href="https://en.wikipedia.org/wiki/Product_rule">product</a>). In the end, you will have to <em>simplify</em> the resulting expression.</p>

<p>You don’t have to implement everything.</p>

<p>You will have to remember the fundamentals of calculus.</p>

<p>It’s going to be fun.</p>

<hr />

<h1 id="a-slot-machine">A slot machine</h1>

<p>… In the name of science.</p>

<p>I wouldn’t put to much effort into the graphics. It’s not like you want to contribute to people’s misfortune and addiction. But the <a href="https://www.youtube.com/watch?v=BFlRH99TQOw">mathematics behind a slot machine</a> can be interesting, plus you can be <em>creative</em>:</p>

<ul>
  <li>Why don’t you write a \(\pi\) slot machine that uses the decimals of \(\pi\) to give prizes.</li>
  <li>Why don’t you use a Game Of Life Slot Machine, where you stop on specific cell configurations and give prizes;</li>
  <li>Why don’t you build a Sinusoidal Slot Machine (you can get inspiration from a previous project of mine called <a href="/2024/02/06/the-sinusoidal-tetris">The Sinusoidal Tetris</a>).</li>
</ul>

<h1 id="write-a-game-engine-for-text-based-games">Write a game engine for text-based games</h1>

<p><sup>This idea was suggested by @snej on the <a href="https://lobste.rs/s/5fsjpu/my_list_challenging_software_projects">lobste.rs</a></sup></p>

<p>Few of our generation have played <em>text-based</em> games, and it’s fine - we need to put our hardware to better use than rendering fonts in a terminal.</p>

<p>But there was a time when games like <a href="https://playclassic.games/games/adventure-dos-games-online/the-hitchhikers-guide-to-the-galaxy/play/">Zork</a> or <a href="https://rickadams.org/adventure/advent/">Colossal Cave</a> were extremely popular.</p>

<p>So why don’t you build a game engine for text-based adventures?</p>

<p>Make the engine <em>cross-platform</em> - allow the game to work in the terminal, browser, or an <a href="https://en.wikipedia.org/wiki/Simple_DirectMedia_Layer">SDL</a> window.</p>

<p>Or leave it terminal only. There are beautiful TUI libraries nowadays, so you don’t have to stay cursed because you are stuck with <a href="https://en.wikipedia.org/wiki/Ncurses">ncurses</a>:</p>

<ul>
  <li><a href="https://github.com/charmbracelet/bubbletea">bubbletea</a></li>
  <li><a href="https://github.com/saccharineboi/CursedGL">CursedGL</a></li>
  <li>… or check out <a href="https://github.com/rothgar/awesome-tuis?tab=readme-ov-file">this list</a>.</li>
</ul>

<h1 id="write-a-tiling-window-manager">Write a Tiling Window Manager</h1>

<p>Now that <a href="https://en.wikipedia.org/wiki/Wayland_(protocol)">Wayland</a> is almost here, I am sure there’s a lot of <em>new</em> room for creativity. Look at <a href="https://swaywm.org/">sway</a>.</p>

<p>Ok, writing a <a href="https://en.wikipedia.org/wiki/Tiling_window_manager">Tiling Window Manager</a> is not the most approachable project you can think of. But at the same time, you can keep things simple. For example, XMonad, when launched, had roughly 1000 lines of code.</p>


guid: /2024/04/24/from-the-circle-to-epicycles
title: From the Circle to Epicycles (Part 1) - An animated introduction to Fourier Series
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/04/24/from-the-circle-to-epicycles
feedurl: https://www.andreinc.net/feed.xml
base: /2024/04/24/from-the-circle-to-epicycles
content_mime_type: text/html
content:
<p>This article will be part of a more extended series in which I plan to explore various aspects of <a href="https://en.wikipedia.org/wiki/Fourier_analysis">Fourier Mathematics</a>. I will take notes, create some visuals (a good pretext to learn more about graphics), and hope that it will be useful to someone other than me.</p>

<p>The article has yet to be thoroughly reviewed by anyone other than me, so I put it online, hoping to get some feedback before bringing it to a final state.</p>

<h1 id="table-of-contents">Table of contents</h1>

<p>In this series, we will start with a brief recap of some of the math concepts related to the circle, including trigonometric functions like sine and cosine. We’ll also discuss Euler’s identity, introduce the concept of a sinusoid (and complex sinusoid), and finally, we’ll introduce the concept of Fourier Series.</p>

<p>The animations used in this series are original, although I drew inspiration from some existing materials found on the web. Please keep in mind that this is not a comprehensive course on the topic, so if you’re really interested in learning more, I recommend taking a full course on the subject.</p>

<ul>
  <li><a href="#the-circle">The Circle</a></li>
  <li><a href="#the-number-pi">The number \(\pi\)</a></li>
  <li><a href="#radians">Radians</a></li>
  <li><a href="#the-sine-and-the-cosine">The sine and the cosine</a></li>
  <li><a href="#the-cos-leads-the-sin">The \(\cos\) leads the \(\sin\)</a></li>
  <li><a href="#the-parity-of-cos-and-sin">The parity of \(\cos\) and \(\sin\)</a></li>
  <li><a href="#complex-numbers-and-the-unit-circle">Complex Numbers and the Unit Circle</a></li>
  <li><a href="#multiplying-with-i-means-a-rotation-with-fracpi2">Multiplying with \(i\) means a rotation with \(\frac{\pi}{2}\)</a></li>
  <li><a href="#eulers-identity">Euler’s identity</a></li>
  <li><a href="#eulers-formula-the-connection-between-e-pi-and-i">Euler’s formula, the connection between \(e\), \(\pi\) and \(i\)</a></li>
  <li><a href="#the-sin-and-cos-in-their-exponential-form">The \(\sin\) and \(\cos\) in their exponential form</a></li>
  <li><a href="#the-sinusoid">The sinusoid</a></li>
  <li><a href="#sinusoids-are-flexible">Sinusoids are <em>flexible</em></a></li>
  <li><a href="#sinusoids-can-be-complex">Sinusoids can be complex</a></li>
  <li><a href="#sinusoids-can-nullify-themselves">Sinusoids can nullify themselves</a></li>
  <li><a href="#adding-sinusoids-leads-to-complexity">Adding sinusoids leads to complexity</a></li>
  <li><a href="#adding-random-sinusoids-for-fun">Adding random sinusoids for fun</a></li>
  <li><a href="#playing-sinusoidal-tetris-for-fun">Playing Sinusoidal tetris for fun</a></li>
  <li><a href="#a-square-wave-and-sinusoids">A square wave and sinusoids</a></li>
  <li><a href="#epicycles-first-encounter">Epicycles - First Encounter</a></li>
  <li><a href="#epicycles-an-intuitive-understanding">Epicycles - An intuitive understanding</a></li>
  <li><a href="#epicycles-a-flower">Epicycles - A flower </a></li>
  <li><a href="#fourier-series">Fourier Series</a></li>
  <li><a href="#fourier-series-in-exponential-form">Fourier Series in Exponential Form</a></li>
  <li><a href="#example-the-fourier-series-for-the-box-function">Example: The Fourier Series for the Box Function</a></li>
  <li><a href="#example-the-fourier-series-of-the-triangle-wave">Example - The Fourier Series of the Triangle wave</a></li>
  <li><a href="#example-the-fourier-series-of-a-sawtooth-function">Example - The Fourier Series of a Sawtooth Function</a></li>
  <li><a href="#the-fourier-series-machinery">The Fourier Series Machinery</a></li>
</ul>

<p><strong>to be continued</strong></p>

<hr />

<h1 id="the-circle">The Circle</h1>

<p>It all starts with <a href="https://en.wikipedia.org/wiki/Circle"><em>The Circle</em></a>:</p>

<div id="simple-circle-sketch"></div>

<p>The Circle is a geometrical figure with a center \(P(a, b)\), and a radius \(r\).</p>

<p>It has the following associated equation:</p>

\[(x-a)^{2} + (y-b)^{2} = r^2\]

<p>If \(a=0, b=0\) and \(r=1\), the circle becomes less generic, so we call it <a href="https://en.wikipedia.org/wiki/Unit_circle"><em>The Unit Circle</em></a>:</p>

<div id="simple-circle-rotating-sketch"></div>

<p>The equation for <em>The Unit Circle</em> is:</p>

\[x^2+y^2=1\]

<p>One could argue <em>The Circle</em> is the epitome of <a href="https://en.wikipedia.org/wiki/Symmetry">symmetry</a>.</p>

<p>Pick one point, \(A\), then its reflection <em>on the other side</em>, \(A^{'}\), and start rotating:</p>

<div id="triangle-in-circle-sketch"></div>

<p>What happens on <em>The Circle</em>, stays on <em>The Circle</em>.</p>

<h1 id="the-number-pi">The number \(\pi\)</h1>

<p>We rarely see angles expressed in <a href="https://en.wikipedia.org/wiki/Degree_(angle)">degrees</a>; usually, we represent them in relation to the number <a href="(https://en.wikipedia.org/wiki/Pi)">PI</a> \(\pi\): \(\pi\), \(\frac{\pi}{2}\), \(\frac{\pi}{3}\), \(\frac{\pi}{4}\), etc.;</p>

<p>\(\pi\) is the ratio of a circle’s circumference to its diameter. <code class="language-plaintext highlighter-rouge">π ≈ 3.14</code>.</p>

<div id="rotating-PI-sketch"></div>

<p>If \(r \neq 1\), the circle’s perimeter is \(P=2\pi r\), while the area is \(A=\pi r^2\). Both \(A\) and \(P\) depend on \(\pi\).</p>

<p>\(\pi\) is <a href="https://en.wikipedia.org/wiki/Irrational_number">irrational</a> and <a href="https://en.wikipedia.org/wiki/Transcendental_number">transcendental</a>.</p>

<h1 id="radians">Radians</h1>

<p>The <a href="https://en.wikipedia.org/wiki/Radian"><code class="language-plaintext highlighter-rouge">radian</code></a> (or <code class="language-plaintext highlighter-rouge">rad</code>) is the <em>actual</em> unit we use to measure angles. An intimate relationship exists between the <code class="language-plaintext highlighter-rouge">radian</code> and the number \(\pi\).</p>

<div id="rotating-PI-w-PI-sketch"></div>

<p>To transform an angle measured in degrees (\(360°\)) to radians, the algorithm is simple: we multiply the angle by \(\pi\), then divide the result by \(180\).</p>

<h1 id="the-sine-and-the-cosine">The sine and the cosine</h1>

<p>We can define \(\sin\) and \(\cos\) in relationship to <em>The Unit Circle</em>:</p>

<div id="simple-circle-rotating-triangle-sketch"></div>

<ul>
  <li>\(\theta\) is the angle formed by the radius, \(r\) and the \(x\) axis, at every given point.</li>
  <li>The \(\sin\) function represents the \(y\)-coordinate of a point on the <em>Unit Circle</em>;</li>
  <li>The \(\cos\) function is the \(x\)-coordinate of the same point on the <em>Unit Circle</em>.</li>
</ul>

<p>\(\sin\) and \(\cos\) are <a href="https://en.wikipedia.org/wiki/Periodic_function"><em>periodic functions</em></a> with the period \(2\pi\).</p>

<div id="simple-osc-sketch"></div>

<p>At this point, it will be unfair for \(\cos\) not to plot it on the same graph:</p>

<div id="simple-osc-cos-sketch"></div>

<h1 id="the-cos-leads-the-sin">The \(\cos\) leads the \(\sin\)</h1>

<p>Putting \(\cos\) and \(\sin\) side by side, we observe that they are not that different:</p>

\[\sin(x+\frac{\pi}{2})=\cos(x)\]

<p>We say that \(\cos\) leads the \(\sin\) with \(\frac{\pi}{2}\):</p>

<div id="sin-cos-side-sketch"></div>

<h1 id="the-parity-of-cos-and-sin">The parity of \(\cos\) and \(\sin\)</h1>

<p>The <a href="https://en.wikipedia.org/wiki/Even_and_odd_functions"><em>parity</em> of mathematical functions</a> generally refers to whether a function is <em>even</em>, <em>odd</em>, or <em>neither</em>.</p>

<p>The <em>cosine</em> is <em>even</em>, meaning \(\cos(x)=\cos(-x)\):</p>

<div id="cosine-parity-sketch"></div>

<p>And the <em>sine</em> is odd, meaning \(\sin(-x)=-\sin(x)\), or \(\sin(x)=-\sin(-x)\):</p>

<div id="sine-parity-sketch"></div>

<h1 id="complex-numbers-and-the-unit-circle">Complex Numbers and the Unit Circle</h1>

<p>In the <a href="https://en.wikipedia.org/wiki/Complex_plane">Complex Plane</a>, the points on the circle are defined by the following equation:</p>

\[z=\cos(\theta)+i*\sin(\theta)\]

<div id="simple-circle-rotating-circle-cmp-sketch"></div>

<h1 id="multiplying-with-i-means-a-rotation-with-fracpi2">Multiplying with \(i\) means a rotation with \(\frac{\pi}{2}\)</h1>

<p>Multiplying a <em>complex number</em> with <a href="https://en.wikipedia.org/wiki/Imaginary_unit">imaginary unit</a> \(i\) is the equivalent of rotating the number counterclockwise with \(\frac{\pi}{2}\) on an “imaginary circle” with the radius: \(r=\mid a + b*i \mid=\sqrt{a^2 + b^2}\)</p>

<p>For example, if we take \(z_{1} \in \mathbb{C}\) and we multiply it three times with \(i\) we will have it <em>rotated</em> into the all 4 quadrants of the circle:</p>

<div id="cmpl-rotation-sketch"></div>

<h1 id="eulers-identity">Euler’s identity</h1>

<p>The natural exponential function, often denoted as \(f(x)=e^{x}\), is a particular case of the exponential function where the base is \(e\), also known as <em>Euler’s Number</em> (\(e \approx 2.71828\)).</p>

<p>\(e\), just like \(\pi\), <a href="https://en.wikipedia.org/wiki/Irrational_number">irrational</a> and <a href="https://en.wikipedia.org/wiki/Transcendental_number">transcendental</a>.</p>

<p>We normally define \(e\) as:</p>

\[e=\sum_{n=0}^{\infty}(\frac{1}{n!})=\frac{1}{0!} + \frac{1}{1!}+\frac{1}{2!}+...\]

\[e=\lim_{x \to \infty}(1+\frac{1}{x})^x\]

\[e=\lim_{x \to 0}(x+1)^{\frac{1}{x}}\]

<p>Even if not obvious, there’s a strong connection between \(e\) and the circle.</p>

<p>The <em>natural exponentiation</em> function is an <a href="https://en.wikipedia.org/wiki/Eigenfunction"><em>eigenfunction</em></a> for <a href="https://en.wikipedia.org/wiki/Derivative">differentiation</a>.</p>

<p>An eigenfunction in this context is a function that, when differentiated, yields a constant multiple of itself:</p>

\[\frac{d}{dx} e^{ax} = a * e^{x}\]

<p>If we substitute \(a \rightarrow e\), by subsequently differentiating \(f(x) = e^{ix}\), we obtain:</p>

\[\frac{d}{dx}f(x) = \frac{d}{dx} (e^{ix}) = i * e^{ix}\]

\[\frac{d^2}{dx^2}f(x) = \frac{d^2}{dx^2} (e^{ix}) = \frac{d}{dx} (i * e^{ix}) = -e^{ix}\]

\[\frac{d^3}{dx^3}f(x) = \frac{d^3}{dx^3} (e^{ix}) = \frac{d}{dx} (-e^{ix}) = -i * e^{ix}\]

\[\frac{d^4}{dx^4}f(x) = \frac{d^4}{dx^4} (e^{ix}) = \frac{d}{dx} (-i*e^{ix}) = e^{ix} = f(x)\]

<p>In simple terms, after we differentiate \(f(x)\) four times (\(f'(x), f''(x), f'''(x), f''''(x)\)), our function does a <em>full circle</em>.</p>

<p>It’s the same pattern described in the previous section when we multiplied our \(z_{1}\) with \(i\).</p>

<p>Subsequently deriving \(e^{ix}\) is the equivalent of subsequently multiplying \(e^{ix}\) with \(i\). Multiplying a complex number with \(i\) means <em>rotating</em> that number in the <em>Complex Plane</em> with \(\frac{\pi}{2}\).</p>

<p>But what is a derivative of a function at a certain point?</p>

<p>It’s the rate of change of that function at that particular point. But we’ve just said that the derivative of \(e^{ix}\) is equivalent to a <em>rotation</em>.</p>

<p>So, the rate of change is rotational.</p>

<p>We can intuitively <em>feel</em> that the function \(e^{ix}\) describes an actual circle.</p>

<p>There’s no other possible solution. So we can boldly affirm that \(e^{ix} = \cos(x) + i*\sin(x)\) (which is the formula discovered by Euler).</p>

<p>Of course, this is not a rigorous demonstration. One can prove Euler’s identity using <a href="https://en.wikipedia.org/wiki/Taylor_series">Taylor Series</a>.</p>

<h1 id="eulers-formula-the-connection-between-e-pi-and-i">Euler’s formula, the connection between \(e\), \(\pi\) and \(i\)</h1>

<p>Euler’s formula is a thing of marvel:</p>

\[e^{ix}=\cos(x) + i * \sin(x)\]

<p>Or, if we choose \(x=\pi\):</p>

\[e^{i\pi}+1=0\]

<h1 id="the-sin-and-cos-in-their-exponential-form">The \(\sin\) and \(\cos\) in their exponential form</h1>

<p>By substituting \(x \rightarrow -x\) into Euler’s identity we obtain:</p>

\[e^{-ix}=\cos(x)-i*\sin(x)\]

<p>If we add/subtract the two equalities, we will obtain the definition of the sine and cosine functions in their exponential form:</p>

\[\cos(x) = \frac{e^{ix} + e^{-ix}}{2}\]

\[\sin(x) = \frac{e^{ix} - e^{-ix}}{2*i}\]

<p>All points of the circle are determined by a functon \(z(x)\), where:</p>

\[z(x)=e^{ix}=\underbrace{\cos(x)}_{Re(x)}+\underbrace{i*\sin(x)}_{Im(x)}\]

<p>\(x\) represents the actual angle \(\theta \in \mathbb{R}\), so \(z(\theta)=e^{i\theta}=cos(\theta)+i*sin(\theta)\).</p>

<p>You’ve seen that we’ve interchanged \(x\) with \(t\) and \(\theta\) throughout the article. It’s confusing, but don’t get confused. We are the ones to decide how to look at \(x\), as an angle or as time.</p>

<h1 id="the-sinusoid">The sinusoid</h1>

<p>A <em>sinusoid</em>, or a <em>sine wave</em>, is a smooth, repetitive curve defined by following function:</p>

\[y(t) = A * \sin(2\pi ft + \varphi) = A * \sin(\omega t + \varphi)\]

<ul>
  <li>\(A\) is called the <em>amplitude</em>, representing the maximum deviation of the function from zero.</li>
  <li>\(f\) is called <em>ordinary frequency</em> and denotes the number of oscillations (the radius moving inside the circle) occurring each second.</li>
  <li>\(\omega=2\pi f\) is called the <em>angular frequency</em>; it’s the same thing as <em>ordinary frequency</em>, but we measure it \(\frac{radians}{second}\);</li>
  <li>\(\varphi\) is called <em>phase offset</em>; it’s measured in radians.</li>
</ul>

<p>If we consider <em>time</em> to be the \(x\)-axis, and \(y(t)\) the \(y\)-axis, the sinusoid becomes:</p>

\[y=f(x)=A * \sin(\omega x + \varphi)\]

<p>The \(\sin\) and \(\cos\) are just particular cases of sinusoids.</p>

<h1 id="sinusoids-are-flexible">Sinusoids are <em>flexible</em></h1>

<p>The following animation is interactive. You can choose the values of \(A=\) 
    <select id="sinusoid_A" onchange="updateSinusoids()">
        <option value="0.5">0.5</option>
        <option value="1">1</option>
        <option value="1.5" selected="">1.5</option>
        <option value="2">2</option>
    </select>
    , \(\omega=\)
        <select id="sinusoid_omega" onchange="updateSinusoids()">
        <option value="-2">-2</option>
        <option value="-1">-1</option>
        <option value="1">1</option>
        <option value="2" selected="">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
    </select> 
    and \(\varphi=\) 
    <select id="sinusoid_phi" onchange="updateSinusoids()">
        <option value="0" selected="">0</option>
        <option value="0.5">π/2</option>
        <option value="1">π</option>
        <option value="1.5">3π/2</option>
    </select> 
    to plot the sinusoid (if you pick \(\varphi=\frac{\pi}{2}\) a cosine is plotted):</p>

<div id="sinusoids-sketch"></div>

<h1 id="sinusoids-can-be-complex">Sinusoids can be complex</h1>

<p>Starting with the definition of a sinusoid:</p>

\[y(t) = A * sin(2\pi ft + \varphi) = A * sin(\omega t + \varphi)\]

<p>If we multiply each side with \(A\):</p>

\[A*e^{i\theta}=A*(\cos(\theta)+i*\sin(\theta))\]

<p>If we substitute \(\theta\) with \(\theta=\omega t + \varphi\) we obtain the complex sinusoid:</p>

\[s(t)=A*e^{i(\omega t + \varphi)} = A * \cos(\underbrace{\omega t + \varphi}_{\theta}) + i * A * \sin(\underbrace{\omega t + \varphi}_{\theta})\]

<p>A <em>complex sinusoid</em> captures the behavior of two sinusoids (one cosine and one sine) on both its axes; on the real part, it behaves like a cosine, while on its imaginary part, it behaves like a sine.</p>

<p>The two are <em>in sync</em> as they both depend on the free variable \(\theta\), expressed as \(\theta=\omega t + \varphi\).</p>

<div id="three-d-complex-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/threedcomplex.js">(Source code)</a></sup></sup></p>

<p>Two interesting observations:</p>
<ul>
  <li>If we project the complex sinusoid on the plane determined by the Y-axis and Z-axis, we will plot a <em>sine</em> (the Imaginary part);</li>
  <li>If we project the complex sinusoid on the plane determined by the X-axis and Z-axis, we will plot a <em>cosine</em> (the Real part);</li>
</ul>

<h1 id="sinusoids-can-nullify-themselves">Sinusoids can nullify themselves</h1>

<p>Two sinusoids in phase and sharing the same amplitude but with opposite frequencies nullify themselves.</p>

<div id="one-negative-sketch"></div>

<h1 id="adding-sinusoids-leads-to-complexity">Adding sinusoids leads to complexity</h1>

<p>Let’s plot two arbitrary selected sinusoids \(y_{1}(x)\) and \(y_{2}(x)\), where:</p>
<ul>
  <li>\(y_{1}(x) = \frac{9}{10} * sin(7x + \frac{\pi}{2})\), and</li>
  <li>\(y_{2}(x) = \frac{12}{10} * sin(3x - 2)\) .</li>
</ul>

<p>The sum \(y(x)=y_{1}(x) + y_{2}(x)\) shows an interesting pattern</p>

<div id="sum-simple-sketch"></div>

<h1 id="adding-random-sinusoids-for-fun">Adding random sinusoids for fun</h1>

<p>Adding more sinusoids to an existing one (\(A=1\), \(\omega=1\), \(\varphi=1\)) generate more complex patterns:</p>

<div id="drop-sinusoid-sketch"></div>

<h1 id="playing-sinusoidal-tetris-for-fun">Playing Sinusoidal tetris for fun</h1>

<p>Not so long ago, <a href="/2024/02/06/the-sinusoidal-tetris">I’ve re-imagined the game of Tetris</a>.</p>

<p>It’s now possible to play Tetris with Sinusoids:</p>

<p><a href="/2024/02/06/the-sinusoidal-tetris"><img src="/assets/images/2024-04-08-from-the-circle-to-epicycles/sinusoida-tetris.png" alt="img" /></a></p>

<h1 id="a-square-wave-and-sinusoids">A square wave and sinusoids</h1>

<p>If we carefully choose the sinusoids, we can create <em>predictable</em> patterns:</p>

<p>Let’s take, for example, use the following formula:</p>

\[y(x) = \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{\sin(2\pi(2k-1)fx)}{2k-1}\]

<p>Through expansion, the formula becomes:</p>

\[y(x) =  \underbrace{\frac{4}{\pi}\sin(\omega x)}_{y_{1}(x)} + \underbrace{\frac{4}{3\pi}\sin(3\omega x)}_{y_{2}(x)} + ... + \underbrace{\frac{4}{(2k-1)\pi}{\sin((2k-1)\omega x)}}_{y_k(x)} + ...\]

<p>\(y_1(x), y_2(x), y_3(x), ..., y_k(x), ...\) are all the individual sinusoids.</p>

<p>If we perform the sum, we will create a <em>square wave</em>. The more sinusoids we pick, the better the approximation.</p>

<p>Please choose how many sinusoids you want to use, and let’s see how the functions look like for <select id="numSins" onchange="updateSins()">
        <option value="1">k=1</option>
        <option value="2">k=2</option>
        <option value="3">k=3</option>
        <option value="4">k=4</option>
        <option value="7" selected="">k=7</option>
        <option value="9">k=9</option>
        <option value="15">k=15</option>
        <option value="20">k=20</option>
    </select> (and \(\omega\)=<select id="sinsFreq" onchange="updateSins()">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
    </select>):</p>

<div id="square-wave-sketch"></div>

<h1 id="epicycles---first-encounter">Epicycles - First Encounter</h1>

<p>One sinusoid has a corresponding circle that <em>spins</em>. So, the above animation can be re-imagined like this:</p>

<p>Pick <select id="sumEpiSins" onchange="updateSumEpi()">
        <option value="1">k=1</option>
        <option value="2">k=2</option>
        <option value="3" selected="">k=3</option>
        <option value="4">k=4</option>
        <option value="7">k=7</option>
        <option value="9">k=9</option>
        <option value="15">k=15</option>
        <option value="20">k=20</option>
    </select> and \(\omega\)=<select id="sumEpiFreq" onchange="updateSumEpi()">
        <option value="1" selected="">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
    </select> to plot the circles and the corresponding \(y_k(x)\) functions:</p>

<div id="sum-epi-sketch"></div>

<h1 id="epicycles---an-intuitive-understanding">Epicycles - An intuitive understanding</h1>

<p>There’s an intuitive proof to this: each epicycle corresponds to a specific sinusoid; when we talk about combining the sinusoids, we are talking about summing their positions at each point in time, and eventually, this operation reduces to subsequent vector additions.</p>

<p>Let’s take a simple example by introducing three arbitrarily picked sinusoids and their associated <em>point vectors</em> (or <em>position vectors</em>):</p>
<ul>
  <li>\(y_{1}(x)=1.4sin(x + 1)\), with the associated position vector \(\vec{u_{1}}\);</li>
  <li>\(y_{2}(x)=0.8sin(2*x)\), with the associated position vector \(\vec{u_{2}}\);</li>
  <li>\(y_{3}(x)=0.5sin(3*x)\), with the associated position vector \(\vec{u_{3}}\).</li>
</ul>

<p>Their sum is \(y(x) = y_{1}(x) + y_{2}(x) + y_{3}(x) = 1.4sin(x + 1) + =0.8sin(2*x) + 0.5sin(3*x)\).</p>

<p>A position vector represents the displacement from the origin \((0, 0)\) to a specific point in space. In our case, the vector \((x, y_{k}(x))\) represents the position or location of a point on the graph of the function(s) \(y_{k}(x)\) at a particular \(x\) value.</p>

<p>If we plot \(y(x)\) on the cartesian grid we obtain something like:</p>

<div id="simple-yx-plot-sketch"></div>

<p>At each given point \(x\), we can say for certain that \(\vec{u} = \vec{u_{1}} + \vec{u_{2}} + \vec{u_{3}}\).</p>

<h1 id="epicycles---a-flower">Epicycles - A flower</h1>

<p>If we carefully pick the <em>right sinusoids</em> the moving circles can describe (approximate) any shape we want.</p>

<p>Here is a flower for example:</p>

<div id="a-flower-sketch"></div>

<p>Can you guess the individual sinusoids working together to draw the flower?</p>

<p>You probably can’t unless you apply methods from a branch of mathematics called <em>Fourier Analysis</em>.</p>

<h1 id="fourier-series">Fourier Series</h1>

<p><em>Fourier Series</em> is the mathematical process through which we expand a periodic function of period \(P\) as a sum of trigonometric functions.</p>

<p>Do you remember the <a href="https://en.wikipedia.org/wiki/Pink_Floyd">Pink Floyd’s</a> album cover for the <a href="https://en.wikipedia.org/wiki/The_Dark_Side_of_the_Moon"><em>Dark Side of The Moon</em></a>:</p>

<p><img src="/assets/images/2023-07-02-painting-with-circles/darksideofthemoon.jpg" alt="img" /></p>

<p>Imagine our function \(f(x)\) is the light itself, <a href="https://en.wikipedia.org/wiki/Prism_(optics)">the prism</a> is essentially <em>Fourier Mathematics</em>, and the spectral colors emanating from the prism are the sinusoids.</p>

<p>Following the analogy the formula looks like this:</p>

\[\underbrace{f(x)}_{\text{ light itself}}=\underbrace{A_{0} + \sum_{n=1}^{\infty} [A_{n} cos(\frac{2\pi nx}{P}) + B_{n} sin(\frac{2\pi nx}{P})]}_{\text{the spectral components}}\]

<p>Where \(A_{n}\) and \(B_{n}\) are called <em>Fourier Coefficients</em> are defined by the following integrals:</p>

\[A_{0} = \frac{1}{P} \int_{- \frac{P}{2}}^{+\frac{P}{2}} f(x) dx\]

\[A_{n} = \frac{2}{P} \int_{- \frac{P}{2}}^{+ \frac{P}{2}} f(x) * \cos(\frac{2\pi nx}{P}) dx\]

\[B_{n} = \frac{2}{P} \int_{- \frac{P}{2}}^{+ \frac{P}{2}} f(x) * \sin(\frac{2\pi nx}{P}) dx\]

<h1 id="fourier-series-in-exponential-form">Fourier Series in Exponential Form</h1>

<p>With the help of Euler’s Formula and by changing the sine and cosine functions in their exponential forms, we can also express the Fourier Series of a function as a sum of <em>Complex Sinusoids</em>:</p>

\[f(x) = \sum_{n=-N}^{N} C_{n} e ^ {i2\pi \frac{n}{P}x}\]

<p>Where:</p>

\[C_{n} = \begin{cases}
            A_{0} &amp; \text{if } n = 0 \\
            \frac{1}{2} (A_{n} - i * B_{n}) &amp;  \text{if } n &gt; 0 \\
            \frac{1}{2} (A_{n} + i * B_{n}) &amp; \text{if } n &lt; 0 \\
        \end{cases}\]

<p>If we do additional substitutions, the final form of \(C_{n}\) is:</p>

\[C_{n} = \frac{1}{P} \int_{-\frac{P}{2}}^{\frac{P}{2}} e^{-i2\pi\frac{n}{P}x} f(x) dx\]

<h1 id="example-the-fourier-series-for-the-box-function">Example: The Fourier Series for the Box Function</h1>

<p>Remember the <em>Square Wave</em> we’ve approximated with sinusoids <a href="#adding-sinusoids">in this section</a>? At that point, we used the following formula to express the <em>Square</em> as a sum of sinusoidal components:</p>

\[y(x) = \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{\sin(2\pi(2k-1)fx)}{2k-1}\]

<p>Or, to keep things simpler, by substituting \(\omega=2\pi f\) (\(\omega\) is the angular frequency):</p>

\[y(x) = \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{\sin((2k-1)\omega x)}{2k-1}\]

<p>It’s time to understand how we’ve devised such an approximation.</p>

<p>In <em>isolation</em>, the <em>Square Wave</em>, \(f(x)\) looks like this:</p>

<div id="square-wave-f-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/squarewavef.js">(Source code)</a></sup></sup></p>

<p>Throughout the interval  <code class="language-plaintext highlighter-rouge">[0, 2L]</code>, \(f(x)\) can be written as:</p>

\[f(x) = 2 [H(\frac{x}{L})-H(\frac{x}{L}-1)] - 1\]

<p>Where \(H(x)\) is called the <a href="https://mathworld.wolfram.com/HeavisideStepFunction.html"><em>Heavisde Step Function</em></a> and has the following definition:</p>

\[H(x) =  \begin{cases}
        0 &amp; \text{if } x \lt 0 \\
        1 &amp; \text{if } x \ge 0 \\
        \end{cases}\]

<p>First of all, let’s look at \(A_{0} = \frac{1}{2L} \int_{0}^{2L} f(x) dx\). Notice how we’ve changed the interval from \([-\frac{P}{2}, \frac{P}{2}]\) to \([0, 2L]\) to match our example. This will be reflected in the formulas.</p>

<p>Well, this coefficient (\(A_{0}\)) is a fancy way to express the average of \(f(x)\) over the interval (in our case <code class="language-plaintext highlighter-rouge">[0, 2L]</code>). In the same time \(A_{0}\) is the area determined by \(f(x)\) over <code class="language-plaintext highlighter-rouge">[0, 2L]</code> then divided by \(2L\). But if you look at the plot again, you will see that the net area is  \(0\), because the green area (S1) nullifies the red area (S2), regardless of \(L\).</p>

<div id="square-wave-f-a0-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/squarewavefa0.js">(Source code)</a></sup></sup></p>

<p>Secondly, let’s compute the \(A_{n} = \frac{1}{L} \int_{0}^{2L} f(x) * \cos(\frac{\pi nx}{L}) dx\) coefficients. An important observation is that \(f(n)\) is odd, and its average value on the interval is \(0\); we can safely say all the coefficients \(A_{n}\) also vanish.</p>

<p>Visually speaking, regardless of how you pick \(n\) or \(L\), the net area determined by the \(A_{n}\) integral will always be zero. It’s visually obvious if we <em>plot</em> \(A_n\). For example plotting \(A_{1}\), \(A_{2}\), \(A_{3}\), \(A_{4}\) looks like this:</p>

<div id="square-wave-f-an-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/squarewavean.js">(Source code)</a></sup></sup></p>

<p>Similar symmetrical patterns will emerge if you increase the \(n\) in \(A_{n}\) and plot them.</p>

<p>Thirdly, we need to compute:</p>

\[B_{n} = \frac{1}{L} \int_{0}^{2L} f(x) * \sin(\frac{\pi nx}{L}) dx\]

<p>If we plot a \(B_{1}\), \(B_{2}\), \(B_{3}\) and, let’s say, \(B_{4}\) we can intuitively <em>feel</em> what’s happening with \(B_{n}\):</p>

<div id="square-wave-f-bn-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/squarewavebn.js">(Source code)</a></sup></sup></p>

<p>If you have a keen eye for geometrical representations, you will notice that every even \(B_{n}\) is also 0. The red and green areas nullify, so the net area described by the integral is \(0\). The odd terms will be \(2 * \text{something}\), so let’s calculate that \(\text{something}\).</p>

<p>We will need to split the integral on two sub-intervals \([0, L]\) and \([L, 2L]\) (there’s a <em>chasm</em> at \(L\)), but given the fact \(f(x)\) and \(sin(x)\) are odd, \(B_{n}\) can we written as:</p>

\[B_{n} = 2 * [\frac{1}{L} \int_{0}^{L} f(x) * \sin(\frac{\pi nx}{L}) dx]\]

<p>We can now perform <a href="https://en.wikipedia.org/wiki/Integration_by_substitution">u-substition</a>, so we can write:</p>

\[B_{n} = \frac{2}{L} \int_{0}^{nL\pi} \frac{\sin(\frac{u}{L})}{n\pi}du\]

<p>After we take the constant out, we compute the integral, use the intervals, and take into consideration the periodicity of cosine:</p>

\[B_{n} = \frac{2}{n\pi}(1-(-1)^n)\]

<p>And now we see it, \(B_{n}\) is exactly \(0\) if \(n\) is even, and \(B_{n}=2 * \frac{2}{n\pi}\) is \(n\) is odd.</p>

<p>Putting all back into the master formula of the <em>Fourier Series</em>:</p>

\[f(x)=\underbrace{A_{0}}_{0} + \sum_{n=1}^{\infty} [\underbrace{A_{n} \cos(\frac{\pi nx}{L})}_{0} + B_{n} \sin(\frac{\pi nx}{L})]\]

<p>Things become:</p>

\[f(x)=\frac{4}{\pi} \sum_{n=1,3,5...}^{+\infty} (\frac{1}{n} * \sin(\frac{\pi nx}{L}))\]

<p>If we substitute \(n \rightarrow 2k-1\) and consider, we obtain the initial formula:</p>

\[f(x)=\frac{4}{\pi} \sum_{k=1}^{+\infty} (\frac{\sin(\frac{\pi (2k-1)x}{L})}{(2k-1)})\]

<p>To obtain the initial formula, we substitute \(L \rightarrow \frac{1}{2f}\), and \(2\pi f \rightarrow \omega\), basically we create an interdependence between \(L\) (half of the interval) and \(\omega\), \(L=\frac{\pi}{\omega}\):</p>

\[f(x) = \frac{4}{\pi}\sum_{k=1}^{\infty}\frac{\sin((2k-1)\omega x)}{2k-1}\]

<p>Unfortunately, there’s no way we can go to \(+\infty\), so let’s consider \(s(x)\) as an approximation of \(f(x)\) that depends on \(n\).</p>

\[s(x) = \frac{4}{\pi}\sum_{k=1}^{n}\frac{\sin((2k-1)\omega x)}{2k-1} \approx f(x)\]

<p>In the next animation, you will see that by increasing \(n\), the accuracy of our approximation gets better and better, and the <em>gaps</em> are slowly closed:</p>

<div id="tight-fourier-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/tightfourier.js">(Source code)</a></sup></sup></p>

<p>To understand how adding more coefficients improves the approximation, let’s look back again at a few of our coefficients \(s_{1}(x)\), \(s_{2}(x)\), \(s_{3}(x)\), \(s_{4}(x)\) and \(s_{5}(x)\) (we will pick \(\omega=\frac{\pi}{2}\), so that \(2L=1\)):</p>

\[s_{1}(x) = \frac{4}{\pi} \sin(\frac{\pi x}{2})\]

\[s_{2}(x) = \frac{4}{3\pi} \sin(\frac{3\pi x}{2})\]

\[s_{3}(x) = \frac{4}{5\pi} \sin(\frac{5\pi x}{2})\]

\[s_{4}(x) = \frac{4}{7\pi} \sin(\frac{7\pi x}{2})\]

\[s_{5}(x) = \frac{4}{9\pi} \sin(\frac{9\pi x}{2})\]

<p>Each of the 5 terms is a sinusoid, with \(\frac{4}{\pi}\), \(\frac{4}{3\pi}\), etc. amplitudes, and \(\frac{\pi}{2}\), \(\frac{3\pi}{2}\), etc. frequencies.</p>

<p>So, if we were to approximate a <em>Square Wave</em> with its fifth partial sum (the red dot), we would obtain something like this:</p>

<div id="tight-fourier-avg-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/tightfourieravg.js">(Source code)</a></sup></sup></p>

<p>Notice how <em>obsessed</em> the <em>red dot</em> is with the <em>blue dot</em> (the actual function) and how closely it follows it.</p>

<p>We can always add more terms to the partial sum to help the <em>red dot</em> in its <em>holy mission</em>, improving the approximation until nobody cares anymore.</p>

<h1 id="example---the-fourier-series-of-the-triangle-wave">Example - The Fourier Series of the Triangle wave</h1>

<p>Without dealing with all the associated math, the <em>Fourier Series</em> decomposition for a triangle-wave is:</p>

\[s(x)=\frac{8}{\pi^2}\sum_{k=1}^{N}\frac{(-1)^{k-1}}{(2k-1)^2}*\sin((2k-1)x)\]

<p>Plotting the function \(s(x)\), we will see that things converge smoothly and fast. As soon as \(n\) approaches \(6\), we can already observe the triangle:</p>

<div id="tight-triangle-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/tighttriangle.js">(Source code)</a></sup></sup></p>

<p>Let’s compute the first terms six terms of the \(\sum\), so that:</p>

\[s(x) \approx s_1(x) + s_2(x) + s_3(x) + s_4(x) + s_5(x) + s_6(x)\]

<p>Where:</p>
<ul>
  <li>The first term is \(s_1(x)=\frac{8}{\pi^2}*\sin(x)\), where \(A=\frac{8}{\pi^2}\), \(\omega=1\), \(\varphi=0\);</li>
  <li>The second term is \(s_2(x)=-\frac{8}{3^2\pi^2}*\sin(3x)\), where \(A=-\frac{8}{3^2\pi^2}\), \(\omega=3\), \(\varphi=0\);</li>
  <li>The third term is \(s_3(x)=\frac{8}{5^2\pi^2}*\sin(5x)\), where \(A=\frac{8}{5^2\pi^2}\), \(\omega=5\), \(\varphi=0\);</li>
  <li>The fourth term is \(s_4(x)=-\frac{8}{7^2\pi^2}*\sin(7x)\), where \(A=-\frac{8}{7^2\pi^2}\), \(\omega=7\), \(\varphi=0\);</li>
  <li>The fifth term is \(s_5(x)=\frac{8}{9^2\pi^2}*\sin(9x)\), where \(A=\frac{8}{9^2\pi^2}\), \(\omega=9\), \(\varphi=0\);</li>
  <li>The sixth term is \(s_6(x)=-\frac{8}{11^2\pi^2}*\sin(11x)\), where \(A=-\frac{8}{11^2\pi^2}\), \(\omega=11\), \(\varphi=0\);</li>
</ul>

<p>A keen eye will see will observe the that \(s_2(x)\), \(s_4(x)\), \(s_6(x)\) and all the even terms are <em>negative</em>.</p>

<p>A negative amplitude doesn’t make too much sense, at least not in a physical sense. What are we going to do with the <em>minus sign</em>?</p>

<p>We have two options:</p>
<ol>
  <li>Because \(\sin(-x)=-\sin(x)\), nobody stops us to make the <em>frequency</em> negative. For example, \(s_2(x)=\frac{8}{3^2\pi^2}*\sin(-3x)\), so that the \(\omega=-3\). But again, why would we want a <em>negative frequency</em>? This also doesn’t make sense in a physical sense.</li>
  <li>We can use \(\vert A \vert\) and shift the signal with \(\pi\), so that \(\varphi=\pi\).</li>
</ol>

<p>In practice, we will go with 2. as it’s more practical and gives us more control, but the two options are equivalent so that we can write \(s_2(x)\) in both ways:</p>

\[s_2(x)=-\frac{8}{3^2\pi^2}*\sin(3x)\]

\[s_2(x)=\frac{8}{3^2\pi^2}*\sin(3x + \pi)\]

<p>Visually speaking, the results will not be surprising if we plot \(sin(-x)\) and \(sin(x+\pi)\) side by side; the two are equivalent:</p>

<div id="pi-shift-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/pishift.js">(Source code)</a></sup></sup></p>

<p>If we consider this, the even terms of \(s(x)\) will become:</p>

<ul>
  <li>\(s_2(x)=\frac{8}{3^2\pi^2}*sin(3x+\pi)\) ;</li>
  <li>\(s_4(x)=\frac{8}{7^2\pi^2}*sin(7x+\pi)\) ;</li>
  <li>\(s_6(x)=\frac{8}{11^2\pi^2}*sin(11x+\pi)\) ;</li>
  <li>…and so on</li>
</ul>

<h1 id="example---the-fourier-series-of-a-sawtooth-function">Example - The Fourier Series of a Sawtooth Function</h1>

<p>Shamelessly skipping the math demonstration, a reverse-sawtooth function has the following form:</p>

\[s(x)=\frac{2}{\pi}\sum_{k=1}^{N}(-1)^k*\frac{\sin(kx)}{k}\]

<p>Plotting \(s(x)\), while increasing \(n\), things look like this:</p>

<div id="tight-sawtooth-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/tightsawtooth.js">(Source code)</a></sup></sup></p>

<h1 id="the-fourier-series-machinery">The Fourier Series Machinery</h1>

<p>To better visualize what’s happening, let’s look at a <em>Fourier Series Machinery</em> and how the <em>circles move</em> to create <em><del>beautiful</del> practical patterns</em>.</p>

<p>You can pick the shape of the desired signal from here: <select id="fm-wave" onchange="updateFmWave()">
        <option value="sawtooth" selected="">sawtooth wave</option>
        <option value="triangle">triangle wave</option>
        <option value="square">square wave</option>
    </select> and the sketch will change accordingly.</p>

<div id="fmachinery-sketch"></div>
<p><sup><sup><a href="//assets/js/2024-04-24-from-the-circle-to-epicycles/fmachinery.js">(Source code)</a></sup></sup></p>

<p>…A bunch of spinning circles on a stick, where each circle corresponds to exactly one term of the series - this is the marvelous <em>Fourier Series Machinery</em>.</p>

<p><img src="/assets/images/2023-07-02-painting-with-circles/fmachinery.jpg" alt="img" /></p>

<p>If we run our signal through the <em>Fourier Series Machinery</em>, we will obtain <em>The Amplitude</em> (\(A\)) and <em>The Phase</em> (\(\varphi\)) for each Frequency (\(\omega\)) from \(1\) to \(N\). Isn’t it amazing? And it all comes down to a bunch of spinning circles… on a stick.</p>

<p><strong>to be continued</strong></p>


guid: /2024/06/06/13-problems-with-logarithms
title: 13 problems with logarithms
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/06/06/13-problems-with-logarithms
feedurl: https://www.andreinc.net/feed.xml
base: /2024/06/06/13-problems-with-logarithms
content_mime_type: text/html
content:
<p>As a side hobby, I like to compose math problems. Solving exercises is one game; creating exercises is another world. It’s fun because you never know where you are going or what you wish to obtain, but sometimes, you can unravel interesting relationships between numbers.</p>

<p>This problem set is <em>an original endeavor</em>, meaning I haven’t purposely copied the problems from an existing book or paper. However, the more straightforward exercises are just “natural” extensions of existing formulas, and I am sure somebody else proposed them first. For example, exercise 4 appears under different forms in various problems you can find online, and exercise 5 is a variation of an existing exercise from the classical Romanian “culegere de probleme” Nastasescu &amp; Nita. I found exercise 8 solved on YouTube with a slight twist: \(a=10, b=e\).</p>

<hr />

<blockquote>
  <p>Note: Nobody other than me has reviewed the problems. If you see any issues with them (they might be totally wrong for some reason, don’t hesitate to contact me).</p>
</blockquote>

<hr />

<h1 id="the-exercises">The exercises</h1>

<ol>
  <li>
    <p><sup><sup>[very easy]</sup></sup> If \(a,b,c \in (0, \infty) \setminus \{1\}\), \(abc \neq 1\), \(x=\log_ba\), and \(y=\log_ca\), then compute \(\log_{abc}a\). <sup><sup><a href="#exercise-1">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> If \(a,b \in (0, \infty) \setminus \{1\}\), \(a^x=(ab)^n\) and \(b^y=(ab)^n\) prove that \(\frac{1}{x}+\frac{1}{y}=\frac{1}{n}\). <sup><sup><a href="#exercise-2">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> Prove that \(\sum_{i=2}^{n}(\frac{1}{\log_i n}) = \prod_{i=n+1}^{n!}(\log_{i-1}i)\), where \(n \gt 2\) and \(n \in \mathbb{N}\). <sup><sup><a href="#exercise-3">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> If \(a^{\log_m x} * x^{\log_m b} = ab\), prove that \(x=m\). <sup><sup><a href="#exercise-4">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[medium]</sup></sup> If \(2\log_b x = \log_c x - \log_a x\), prove that \(c^2=(\frac{a}{c})^{\log_a b}\). <sup><sup><a href="#exercise-5">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[hard]</sup></sup> If \(\rvert \log_a x \log_b x \lvert=\lvert \log_b x \log_c x + \log_a x \log_c x + \log_a x \log_b x\rvert\), prove that \(c=(abc)^{\log_c(abc)}\). <sup><sup><a href="#exercise-6">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> Find \(x\) if \(a,b,c \in (0,1) \cup (1, \infty)\), and \(a^{\ln\frac{b}{c}}*b^{\ln\frac{c}{a}}*c^{\ln\frac{a}{x}}=1\).<sup><sup><a href="#exercise-7">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[hard]</sup></sup> Solve \((\log_ax)^{\log_bx} = (\log_bx)^{\log_ax}\).<sup><sup><a href="#exercise-8">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> If \(a,b,m \in (0,1)\) or \(a,b,m \in (1, \infty)\), prove that \(\frac{\log_{ab}m}{\sqrt{\log_am*\log_bm}} \le 1\). <sup><sup><a href="#exercise-9">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[easy]</sup></sup> If \(a,b,m \in (0,1)\) or \(a,b,m \in (1, \infty)\), prove \(\frac{1}{\log_{(a+b)}m} \ge \frac{1}{\log_2m} + \frac{1}{2}(\frac{1}{\log_am}+\frac{1}{\log_bm})\). <sup><sup><a href="#exercise-10">solution</a></sup></sup></p>
  </li>
  <li>
    <p><sup><sup>[medium]</sup></sup> If \(x_i \in (0,1)\) or \(x_i \in (1, \infty)\), prove \(\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}} \ge n - \log_{x_n}x_1\), \(\forall n \in \mathbb{N}, n \ge 2\).<sup><sup><a href="#exercise-11">solution</a></sup></sup></p>
  </li>
</ol>

<p>12.<sup><sup>[medium]</sup></sup> If \(x=\log_b c\), \(y=\log_a c\), and \(m=\log_{abc} c\), prove that \((\frac{1}{m \sqrt{3}}-1)(\frac{1}{m \sqrt{3}}+1) \le \frac{1}{x^2} + \frac{1}{y^2}\).<sup><sup><a href="#exercise-12">solution</a></sup></sup></p>

<p>13.<sup><sup>[medium]</sup></sup> If \(a,b,m \in (0,1)\) or \(a,b,m \in (1, \infty)\), prove \(\sum_{i=2}^{n-1}\log_i(i+1)\ge \sum_{i=2}^{n-1}\log_i2+\frac{n-2}{2}\).<sup><sup><a href="#exercise-13">solution</a></sup></sup></p>

<h1 id="solutions">Solutions</h1>

<h2 id="exercise-1">Exercise 1</h2>

<p>\(\log_{abc}a=\frac{1}{log_a(abc)}=\frac{1}{\log_aa+\log_ab+\log_ac} = \frac{1}{1 + \frac{1}{x}+\frac{1}{y}}=\frac{xy}{xy+x+y}\).</p>

<h2 id="exercise-2">Exercise 2</h2>

<p>If \(a^x=(ab)^n \Rightarrow x = \log_{a}(a^nb^n) = n + n\log_ab = n(1+\log_ab)\).</p>

<p>In a similar fashion, if \(b^y=(ab)^n \Rightarrow y = \log_{b}(a^nb^n) = n + n\log_ba = n(1+\log_ba) = \frac{n(\log_ab+1)}{\log_ab}\).</p>

<p>With this in mind, \(\frac{1}{x}+\frac{1}{y}=\frac{1}{n(1+\log_ab)} + \frac{log_ab}{n(1+\log_ab)} = \frac{1+\log_ab}{n(1+\log_ab)}=\frac{1}{n}\).</p>

<h2 id="exercise-3">Exercise 3</h2>

<p>We start with the sum:</p>

\[\sum_{i=2}^{n}(\frac{1}{\log_i n}) = \frac{1}{\log_2 n} + \frac{1}{\log_3 n} + ... + \frac{1}{\log_n n} \Leftrightarrow \\
\sum_{i=2}^{n}(\frac{1}{\log_i n}) = \log_n 2 + \log_n 3 + ... + \log_n n \Leftrightarrow \\
\sum_{i=2}^{n}(\frac{1}{\log_i n}) = \log_n n!\]

<p>Then we compute the product:</p>

\[\prod_{i=n+1}^{n!}[\log_{i-1}i] = \underbrace{\underbrace{\log_n(n+1) * \log_{n+1}(n+2)}_{=\log_n(n+2)} * .}_{=\log_nk}.. * \log_{n!-1}(n!) \Leftrightarrow \\
\prod_{i=n+1}^{n!}[\log_{i-1}i] = \log_n(n!)\]

<p>As we can see the sum and product are equal.</p>

<h2 id="exercise-4">Exercise 4</h2>

<p>We know that: \(a^{\log_m x} * x^{\log_m b} = ab\).</p>

<p>Let’s write \(x^{\log_m b}=k\).</p>

<p>This would be equivalent to:</p>

\[\log_m(x^{\log_m b})=\log_m k \Leftrightarrow \\
\log_m b * \log_m x =\log_m k \Leftrightarrow \\
\log_m x * \log_m b =\log_m k \Leftrightarrow \\
\log_m (b^{\log_m x})=\log_m k \Leftrightarrow \\
b^{\log_m x} = k\]

<p>So we can re-write our initial relationship as:</p>

\[a^{\log_m x} * b^{\log_m x} = ab \Leftrightarrow \\
(ab)^{\log_m x} = (ab)^1 \Rightarrow \\
\log_m x = 1 \Rightarrow \\
x = m\]

<h2 id="exercise-5">Exercise 5</h2>

<p>\(2\log_b x = \log_c x - \log_a x\) is equivalent to:</p>

\[\frac{2}{\log_x b}=\frac{\log_x a - \log_x c}{\log_x a \log_x c}\]

<p>We re-write everything as:</p>

\[2*\log_x c = \frac{\log_x b}{\log_x a}*(\log_x a - \log_x c)\]

<p>The latest is equivalent to:</p>

\[\log_x c^2 = \log_a b * \log_x \frac{a}{c} \Leftrightarrow \
\log_x c^2 = \log_x (\frac{a}{c})^{\log_a b}\]

<p>Finally, we have proven:</p>

\[c^2=(\frac{a}{c})^{\log_a b}\]

<h2 id="exercise-6">Exercise 6</h2>

<p>The modulus is there as a hint that you can square both sides.</p>

\[|\log_a x \log_b x|=|\log_b x \log_c x + \log_a x \log_c x + \log_a x \log_b x| \Leftrightarrow \\ \\
(\log_a x \log_b x)^2=(\log_b x \log_c x + \log_a x \log_c x + \log_a x \log_b x)^2 \Leftrightarrow \\ \\
\frac{\log_c x}{\log_c x} (\log_a x \log_b x)^2 = (\log_b x \log_c x + \log_a x \log_c x + \log_a x \log_b x)^2 \Leftrightarrow \\ \\
\frac{1}{\log_c x} = \frac{(\log_b x \log_c x + \log_a x \log_c x + \log_a x \log_b x)}{\log_a x \log_b x \log_c x} *  \frac{(\log_b x \log_c x + \log_ax \log_cx + \log_ax \log_bx)}{\log_ax \log_bx}\Leftrightarrow \\ \\
\frac{1}{\log_c x}=(\frac{1}{log_a x} + \frac{1}{\log_b x} + \frac{1}{\log_c x})(\frac{\log_c x}{\log_a x}  + \frac{\log_c x}{\log_b x} + 1) \Leftrightarrow \\ \\
\log_x c = (\log_x a + \log_x b + \log_x c)(\frac{log_x a}{log_x c} + \frac{\log_x b}{\log_x c} + \frac{\log_x c}{\log_x c}) \Leftrightarrow \\ \\
\log_x c = (\log_x a + \log_x b + \log_x c)(\log_c a + \log_c b + \log_c c) \Leftrightarrow \\ \\
\log_x c = \log_x(abc) * \log_c(abc) \Leftrightarrow \\ \\
c = (abc)^{\log_c(abc)}\]

<h2 id="exercise-7">Exercise 7</h2>

\[\ln a*\ln\frac{b}{c} + \ln b*\ln\frac{c}{a} + \ln c*\ln{a}{x}=0 \Leftrightarrow \\
\ln a(\ln b-\ln c) + \ln b (\ln c - \ln a) + \ln (\ln a - \ln x) = 0\]

<p>After reducing the terms further:</p>

\[\ln c(\ln b - \ln x) = 0 \Rightarrow x = b\]

<h2 id="exercise-8">Exercise 8</h2>

<p>Not all the math questions have nice answers.</p>

\[(\log_ax)^{\log_bx} = (\log_bx)^{\log_ax} \Leftrightarrow \\
\log_b[(\log_ax)^{\log_bx}] = \log_b[(\log_bx)^{\log_ax}] \Leftrightarrow \\
(\log_bx)*\log_b(\log_ax) = \log_ax*\log_b(\log_bx) \Leftrightarrow \\
(\log_bx)*\log_b(\log_ax) = \frac{\log_bx}{\log_ba}*\log_b(\log_bx) \Leftrightarrow \\
\log_b(\frac{\log_bx}{\log_ba}) = \frac{\log_b(\log_bx)}{\log_ba} \Leftrightarrow \\
\log_b(\log_bx)-\log_b(\log_ba) = \frac{\log_b(\log_bx)}{\log_ba} \Leftrightarrow \\
\log_b(\log_bx) - \frac{\log_b(\log_bx)}{\log_ba} = \log_b(\log_ba) \Leftrightarrow \\
\log_b(\log_bx)(1-\frac{1}{\log_ba}) = \log_b(\log_ba) \Leftrightarrow \\
\log_b(\log_bx) = \frac{\log_b(\log_ba) \log_ba}{log_ba-1} \Leftrightarrow \\
x = b^{b^{\frac{\log_b(\log_ba) \log_ba}{log_ba-1}}}\]

<h2 id="exercise-9">Exercise 9</h2>

\[\frac{\log_{ab}m}{\sqrt{\log_am*\log_bm}} \le 1 \Leftrightarrow \\ \\
\log_{ab}m \le \sqrt{\log_am*\log_bm} \Leftrightarrow \\ \\
\frac{1}{\log_m(ab)} \le \sqrt{\log_am*\log_bm} \Leftrightarrow \\ \\
\frac{1}{\log_ma + \log_mb} \le \sqrt{\log_am*\log_bm} \Leftrightarrow \\ \\
\frac{1}{\frac{1}{\log_am} + \frac{1}{\log_bm}} \le \sqrt{\log_am*\log_bm}\]

<h2 id="exercise-10">Exercise 10</h2>

\[\frac{1}{\log_{(a+b)}m} \ge \frac{1}{\log_2m} + \frac{1}{2}(\frac{1}{\log_am}+\frac{1}{\log_bm}) \Leftrightarrow \\
\log_m(a+b) \ge \log_m2 + \frac{1}{2}(\log_ma + \log_mb) \Leftrightarrow \\
\log_m(a+b) - \log_m2 \ge \log_m\sqrt{ab} \Leftrightarrow \\
\log_m(\frac{a+b}{2}) \ge \log_m\sqrt{ab}\]

<h2 id="exercise-11">Exercise 11</h2>

\[\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}} \ge n  \Leftrightarrow \\
\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}} + \log_{x_n}x_1 \ge n\]

<p>From the QM-AM-GM inequality:</p>

\[\frac{\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}} + \log_{x_n}x_1}{n} \ge (\log_{x_n}x_1*\underbrace{\prod_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}}}_{=\log_{x_{1}}x_n})^{\frac{1}{n}} \Leftrightarrow \\
\frac{\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1}} + \log_{x_n}x_1}{n} \ge (\underbrace{\log_{x_n}x_1 * \log_{x_1}x_n}_{=1})^{\frac{1}{n}}\Leftrightarrow \\
\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1} + \log_{x_n}x_1}{n} \ge n \Leftrightarrow \\
\sum_{i=1}^{n-1}\log_{x_{i}}{x_{i+1} \ge n - \log_{x_n}x_1}{n}\]

<h2 id="exercise-12">Exercise 12</h2>

\[m=\log_{abc} c  \Leftrightarrow \\
\frac{1}{m}=\frac{1}{log_{abc} c} \Leftrightarrow \\
\frac{1}{m}=\log_c(abc) \Leftrightarrow \\
\frac{1}{m}=\log_c a + \log_c b + 1 \Leftrightarrow \\
\frac{1}{m}=\frac{1}{\log_a c} + \frac{1}{log_b c} + 1\]

<p>So we can conclude that \(\frac{1}{m}=\frac{1}{x} + \frac{1}{y} + 1\).</p>

<p>Applying the Cauchy-Schwartz inequality:</p>

\[(\frac{1}{x}*1 + \frac{1}{y}*1 + 1*1)^2 \le (\frac{1}{x^2} + \frac{1}{y^2}+1)(1^2 + 1^2 + 1^2)\]

<p>Leads to:</p>

\[\frac{1}{m^2} \lt 3(\frac{1}{x^2} + \frac{1}{y^2}+1) \Leftrightarrow \\
(\frac{1}{m \sqrt{3}}-1)(\frac{1}{m \sqrt{3}}+1) \le \frac{1}{x^2} + \frac{1}{y^2}\]

<h2 id="exercise-13">Exercise 13</h2>

<p>The solution is left to the reader.</p>


guid: /2024/07/25/how-to-compose-math-problems
title: How to compose math problems
author: Andrei Ciobanu
url: https://www.andreinc.net/2024/07/25/how-to-compose-math-problems
feedurl: https://www.andreinc.net/feed.xml
base: /2024/07/25/how-to-compose-math-problems
content_mime_type: text/html
content:
<p>When I was a young student (around 12), my math teacher came-up with an unique requirement for his students to not only solve math problems but also to compose them.</p>

<p>This unconventional approach encouraged his students (me and my classmates) to think creatively and critically, fostering a deeper understanding of the areas we were learning about. While the task was not mandatory, some classmates and I embraced the challenge and worked on developing geometry and algebra exercises from “scratch”. I am not sure how original we were, but the efforts paid off when our <em>little creations</em> were published in an obscure math magazine I cannot find online.</p>

<p>To this day, I create problems that I rarely publish (one notable exception would be <a href="/2024/06/06/13-problems-with-logarithms">my previous article</a>).</p>

<p>In any case, with time, I’ve developed a taste of what a <em>beautiful</em> problem looks like. Of course, <em>beauty is in the eye of the beholder</em>, so, for me, a <em>beautiful math problem</em> is concise, shows <em>symmetry</em>, and is easy to read and understand even if you haven’t mastered that particular domain.</p>

<p>Let me give you an example:</p>

<blockquote>
  <p>Prove the following inequality:</p>

\[\frac{a}{b+2c+d}+\frac{b}{c+2d+a}+\frac{c}{d+2a+b}+\frac{d}{a+2b+c} \ge 1\]

\[\forall a,b,c,d \gt 0.\]
</blockquote>

<p>This is what I call an excellent problem, as it’s concise, a 12-year-old can understand the requirement, and moreover, it showcases a certain symmetry that pleases the eye that looks for patterns. And, no, I did not create the problem, nor is it easy to solve (but not impossible if you know how to juggle with fundamental inequalities).</p>

<p>In any case, let’s try to create a problem for fun. By the end of the article, I might convince you to try this as a hobby.</p>

<h2 id="step-1">Step 1</h2>

<p>Start with a nice and easy problem that caught your attention. It should be something simple, numbers instead of letters.</p>

<p>Let me give you an example, a sample problem from the admission exam for the <a href="https://en.wikipedia.org/wiki/Bucharest_Academy_of_Economic_Studies"><em>Academia De Studii Economice, Bucuresti</em></a>:</p>

<blockquote>
  <p>If \(a=\ln5\), \(b=a+\ln2\) and \(T=\log_{20}8\), prove \(T=\frac{3(b-a)}{2b-a}\).</p>
</blockquote>

<p>I will not ask you to pause for a moment because this is not YouTube, so here is the straight-forward solution: we just change the base for \(T=\log_{20}8=\frac{\ln8}{\ln20}=\frac{3\ln2}{\ln5+2\ln2}\).</p>

<p>But, because \(\ln2=b-a\), \(T\) can be rewritten as: \(T=\frac{3(b-a)}{2(b-a)+a}=\frac{3(b-a)}{2b-a}\).</p>

<p>It’s a cute problem that checks if the student can apply basic formulas.</p>

<h2 id="step-2">Step 2</h2>

<p>Take a step back and look for some <em>hidden</em> information, try to understand the <em>core</em> of why the problem works.</p>

<p>One observation to make is that the numbers \(2\), \(5\), \(8\) and \(20\) were not randomly chosen. \(2\) and \(5\) are prime numbers, while \(T=\log_{20}8\) combines the two, as \(20=2^2 * 5\) and \(8=2*2*2\).</p>

<p>This is why we can express \(T\) as an expression involving \(a\) and \(b\).</p>

<p>So we can already generalize a little: if we replace \(2\) and \(5\) with two arbitrary prime numbers, we already have a new problem:</p>

<blockquote>
  <p>If \(m\), \(n\) are prime numbers, \(a=\ln m\), \(b=a + \ln n\), and \(T=\log_{(m*n^2)}(n^3)\), prove \(T=\frac{3(b-a)}{2b-a}\).</p>
</blockquote>

<p>After this first <em>iteration</em>, the <em>new</em> problem is as concise as before, but it’s not exactly original, nor does the expression \(\frac{3(b-a)}{2b-a}\) looks <em>symmetrical</em> enough for my taste, not to mention the ugly \(\log_{(m*n^2)}(n^3)\).</p>

<p>But what if \(m\), \(n\) are not prime numbers? Is it still working? That’s a different route we can take.</p>

<h2 id="step-3">Step 3</h2>

<p>Let’s change \(T\) into something more <em>beautiful</em> and concise. Why not proving \(T=\frac{b-a}{b+a}\).</p>

<p>At this point, we have to <em>backtrack</em> the new value of \(T\) in its logarithmic form. So if we’ve picked \(T=\frac{b-a}{b+a}\), then \(T=\frac{\ln n}{\ln n + \ln m + \ln m}=\frac{\ln n}{\ln (n*m^2)}=\ln_{(n*m^2)}n\).</p>

<p>So the new problem has just become:</p>

<blockquote>
  <p>If \(m\), \(n\) are prime numbers, \(a=\ln m\), \(b=a + \ln n\), and \(T=\log_{(m*n^2)}n\), prove \(T=\frac{b-a}{b-a}\).</p>
</blockquote>

<p>The new results are underwhelming. \(T=\log_{(m*n^2)}n\) still looks bad, and honestly speaking, the problem is still elementary.</p>

<h2 id="step-4">Step 4</h2>

<p>At this point, we can think of new ways of making the problem more difficult, so why aren’t we introducing more prime numbers to see how things change? So instead of having \(a\), and \(b\), let’s introduce \(a, b, c, d\), where:</p>

\[\begin{cases}
a=\ln2 \\
b=\ln3 + a \\
c=\ln5 + b \\
d=\ln7 + c
\end{cases}\]

<p>But hey, there’s a pattern we can already spot. Why don’t you look at this from a different angle:</p>

\[\begin{cases}
\ln2=a \\
\ln3=b-a \\
\ln5=c-b \\
\ln7=d-c
\end{cases}\]

<p>If we sum-up \(\ln2+\ln3+\ln5+\ln7=\ln(2*3*5*7)=a+(b-a)+(c-b)+(d-c)=d\). The terms are reducing themselves nicely, so we are close to getting something more… <em>beautiful</em>.</p>

<p>How about obtaining something like \(T=\frac{d-a}{d+a}\) ? We already know that \(d=\ln(2*3*5*7)\). Then \(d-a=\ln(3*5*7)\), while \(d+a=\ln2+\ln(2*3*5*7)\).</p>

<p>It’s nice, our <em>new</em> problem becomes:</p>

<blockquote>
  <p>If \(a=\ln2\), \(b=\ln2+a\), \(c=\ln5+b\), \(d=\ln5+c\), and \(T=\log_{(2*2*3*5*7)}(3*5*7)\), prove \(T=\frac{d-a}{d+a}\).</p>
</blockquote>

<p>Can you see the pattern \(T=\log_{(2*2*3*5*7)}(3*5*7)\) ? The base of the algorithm is the product of the first four prime numbers (\(2\) appears twice), while the argument of the logarithm is the product of the first four prime numbers minus the first one (\(2\)).</p>

<h2 id="step-5">Step 5</h2>

<p>Now, it is time for a further generalization, the final touch.</p>

<p>Let’s pick \(n\) prime numbers \(p_n\) and their corresponding \(a_n\).</p>

\[\begin{cases}
a_1 = \ln p_1 \\
a_2 = a_1 + \ln p_2 \\
a_3 = a_2 + \ln p_3 \\
... \\
a_n = a_{n-1} + \ln p_n
\end{cases}\]

<p>Or from a different perspective:</p>

\[\begin{cases}
\ln p_1 = a_1 \\
\ln p_2 = a_2 - a_1 \\
\ln p_3 = a_3 - a_2 \\
... \\
\ln p_n = a_n - a_{n-1}
\end{cases}\]

<p>Again, if we sum them up, we observe that: \(\sum_{i=1}^n \ln p_i = \ln (\prod_{i=1}^n p_i) = a_n\). Additionally:</p>

\[\begin{cases}
a_n - a_1 = \ln (\prod_{i=2}^n p_i) \\
a_n + a_1 = \ln (p_1 * \prod_{i=1}^n p_i) 
\end{cases}\]

<p>So why don’t we formulate our problem in the following manner:</p>

<blockquote>
  <p>Given \(P_n=\{p_i \mid p_i \text{ is the ith prime, } i=1,2,3...,n\}\), and \(a_1=\ln p_1\), \(a_2=a_1 + \ln p_2\), …, \(a_n=a_{n-1}+\ln p_n\), if \(\log_kt=\frac{a_n-a_1}{a_n+a_1}\), prove that there is at least one solution so that \(k,t \in \mathbb{N}\), and \(k,t\) have consecutive prime factors.</p>
</blockquote>

<p>Based on what we discussed, the answer is:</p>

\[\begin{cases}
k=p_1\prod_{i=1}^n(p_i)\\
t=\prod_{i=2}^n(p_i)
\end{cases}\]

<p>\(k\) is the product of the first \(n\) prime numbers, with \(2\) appearing twice.</p>

<p>\(t\) is the product of the first \(n\) prime numbers, excluding \(2\).</p>

<p>If we put everything back into the formula, you will see the answer is correct:</p>

\[\log_kt=\frac{\ln t}{\ln k}=\frac{\ln(\prod_{i=2}^n(p_i))}{\ln(p_1\prod_{i=1}^n(p_i))} = \frac{\ln(p_2 * ... * p_n)}{\ln(p_1*p_1*...*p_n)}=\\
\\
\\
\frac{\ln p_2 + ... + \ln p_n}{\ln p_1 + \ln p_1 + ... + \ln p_n}=\frac{a_n-a_1}{a_n + a_1}
\\\]

<h2 id="conclusion-1">Conclusion 1</h2>

<p>It’s nice to see that with enough pattern spotting and a clear plan, you can transform the initial problem:</p>

<blockquote>
  <p>If \(a=\ln5\), \(b=a+\ln2\) and \(T=\log_{20}8\), prove \(T=\frac{3(b-a)}{2b-a}\).</p>
</blockquote>

<p>To this:</p>

<blockquote>
  <p>Given \(P_n=\{p_i \mid p_i \text{ is prime ith prime, } i=1,2,3...,n\}\), and \(a_1=\ln p_1\), \(a_2=a_1 + \ln p_2\), …, \(a_n=a_{n-1}+\ln p_n\), if \(\log_kt=\frac{a_n-a_1}{a_n+a_1}\), prove that there is at least one solution so that \(k,t \in \mathbb{N}\), and \(k,t\) have consecutive prime factors.</p>
</blockquote>

<p>They are the same problem if you take that one step back and look closer.</p>

<p>So where is the creative touch, you would ask? I am asking myself the same question.</p>

<h1 id="conclusion-2">Conclusion 2</h1>

<p>Is the problem we’ve come up with a good one? I am not sure; sometimes, our route takes us nowhere. Sometimes, we can “discover” beautiful truths camouflaged as math problems.</p>


guid: /2024/11/18/a-function-to-approximate-raising-small-numbers-to-small-irrational-powers
title: A joke in approximating numbers raised to irrational powers
author: Andrei Ciobanu
feedurl: https://www.andreinc.net/feed.xml
base: /2024/11/18/a-function-to-approximate-raising-small-numbers-to-small-irrational-powers
content_mime_type: text/html
url:
https://www.andreinc.net/2024/11/18/a-function-to-approximate-raising-small-numbers-to-small-irrational-powers

content:
<h2 id="how-it-started">How it started</h2>

<p>The story behind this post surprisingly starts on Facebook, on a group dedicated to mathematics. A math teacher asked audience to find the \(\lfloor 3^{\sqrt{3}}\rfloor\) without using a calculator. Of course, it was a matter of proving \(\lfloor 3^{\sqrt{3}}\rfloor=6\), or that \(\lfloor 3^{\sqrt{3}}\rfloor=7\) (my intuition said it’s 7).</p>

<p>After a few back and forth discussions, everyone agreed the following solution (by Mihai Cris) is the <em>most acceptable</em>:</p>

\[3^{7}&gt;2^{10} \Rightarrow 3^{7}*3^{10}&gt;2^{10}*3^{10} \Rightarrow 3^{17} &gt; 6^{10} \Rightarrow 3^{\frac{17}{10}}&gt;6 \Rightarrow 3^{1.7} &gt; 6\]

<p>In the same time:</p>

\[3^7=2187&lt;2401=7^4 \Rightarrow 3^{7/4} &lt; 7 \Rightarrow 3^{1.75}&lt;7\]

<p>Because \(\sqrt{3}\approx 1.73 \Rightarrow \lfloor 3^{\sqrt{3}}\rfloor=6\).</p>

<p><strong>Later edit:</strong></p>

<p>After <a href="https://old.reddit.com/r/math/comments/1gu95wu/a_joke_in_approximating_numbers_raised_to/">posting on reddit</a>, <code class="language-plaintext highlighter-rouge">/u/JiminP</code> came with a different solution:</p>

\[6^3=2^3*3^3&lt;3^2*3^3=3^5 \Rightarrow 6 &lt; 3^{\frac{5}{3}}=3^{\sqrt{\frac{25}{9}}}&lt;3^{\sqrt{\frac{27}{9}}}&lt;3^{\sqrt{3}}\]

<p>In the same time:</p>

<p>\(48&lt;49 \Rightarrow 3*2^4 &lt; 7^2\) and \(3^7&lt;256*3^2=2^8*3^2&lt;7^4 \Rightarrow 7^4 &gt; 3^{\frac{7}{4}}=3^{\sqrt{\frac{49}{16}}} &gt; 3^{\sqrt{\frac{48}{16}}} &gt; 3^{\sqrt{3}}\)</p>

<p>The decision on which solution is the best is <a href="https://academia.stackexchange.com/questions/20084/is-using-the-phrase-is-left-as-an-exercise-for-the-reader-considered-good">left to the reader</a>.</p>

<h2 id="the-new-problem">The new problem</h2>

<p>The previous problem was cute, but it made me wonder if I can find a way to approximate (small) numbers raised to (small) irrational powers <strong>without using a calculator</strong> (no logarithms and radicals), by relying solely on <strong>addition</strong> and <strong>multiplication</strong>. Basically I was looking for a solution where pen, paper and patience are enough.</p>

<p>This is primarily a joke, so if you don’t want to continue reading, here is the answer:</p>

\[a^{\sqrt{c}} \approx \frac{-120-60[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}-[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}{-120+60[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}+[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}\]

<p>(… as long as \(\frac{1}{2} &lt; \ln a * \sqrt{c} &lt; 3\))</p>

<h2 id="the-first-attempt">The first attempt</h2>

<p>The <em><a href="https://en.wikipedia.org/wiki/Logarithm">Logarithmic</a></em> and the <em><a href="https://en.wikipedia.org/wiki/Exponential_function">Exponential</a></em> functions came to the rescue.</p>

<ol>
  <li>We start by writing \(3^{\sqrt{3}}=(e^{\ln 3})^{\sqrt{3}}=e^{\sqrt{3}\ln 3}\). We know this is true because \(3=e^{\ln 3}=3^{\ln e}=3\).</li>
  <li>We use the <a href="https://en.wikipedia.org/wiki/Taylor_series">Taylor Series</a> expansion of \(e^x=1+\frac{x^1}{1!}+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4!}+\dots\) .</li>
  <li>So approximating \(3^{\sqrt{3}}\) is just a matter of computing \(1+\frac{(\sqrt{3}\ln 3)^1}{1!}+\frac{(\sqrt{3}\ln 3)^2}{2!}+\frac{(\sqrt{3}\ln 3)^3}{3!}+\frac{(\sqrt{3}\ln 3)^4}{4!}+\dots\).</li>
</ol>

<p>To get even closer to the actual result, I computed the first 8 terms of the series expansion (and no, it wasn’t by hand, as I’ve used <a href="https://www.wolframalpha.com/">WolframAlpha</a> do it for me):</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>1+Sqrt[3]*Ln[3]+(Sqrt[3]*Ln[3])^2/2!+(Sqrt[3]*Ln[3])^3/3!+(Sqrt[3]*Ln[3])^4/4!+(Sqrt[3]*Ln[3])^5/5!+(Sqrt[3]*Ln[3])^6/6!+(Sqrt[3]*Ln[3])^7/7!+(Sqrt[3]*Ln[3])^8/8!
</code></pre></div></div>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/wa1.png" alt="img" height="50%" width="50%" /></p>

<h2 id="the-eureka">The eureka!</h2>

<p>At this point I had a few <em>flashbacks</em> from my school days.</p>

<p>Firstly, there was something called <em><a href="https://en.wikipedia.org/wiki/Small-angle_approximation">Small Angle Approximations</a></em>, that happen when the angle is, as you would expect, (very) very small:</p>

\[\sin(x) \approx x \\
\cos(x) \approx 1-\frac{x^2}{2} \\
\tan(x) \approx x\]

<p>So I’ve wondered if there isn’t something similar for \(e^x, \ln x\) and \(\sqrt{x}\), anything that works for small numbers.</p>

<p>Secondly, I remember watching a few months ago a video from <a href="https://www.youtube.com/@MichaelPennMath">Michael Penn</a>, about something called <em>Padé  Approximations</em>: <a href="https://www.youtube.com/watch?v=Y3PukSgFWRc">Pade Approximation – unfortunately missed in most Caclulus courses</a>. It was a subject worth exploring.</p>

<h2 id="pade-approximations-are-smooth">Pade approximations are “smooth”</h2>

<p>So, without going into too much details, a Padé approximation is a rational function (the ratio of two polynomials) used to represent a given function. The smart idea behind this technique is to distribute the <em>control points</em> of a polynomial between the denominator and the numerator of the rational function.</p>

<p>A Padé approximation of order <code class="language-plaintext highlighter-rouge">[m/n]</code> for a function \(f(x)\) is expressed as:</p>

\[f(x) \approx P_{[m,n]}(x)=\frac{a_0+a_1x+a_2x^2+\dots+a_mx^m}{1+b_1x+b_2x^2+\dots+b_nx^n}\]

<p>Compared to <em>Taylor Series</em>, Padé seem to handle exponential behaviors and discontinuities better, plus in a lot of cases it converges faster.</p>

<p>Needless to say, I was curious how well those approximations actually work, so I’ve computed the Padé aproximation of order <code class="language-plaintext highlighter-rouge">[1/1]</code>, \(P_{[1/1]}(x)\) for \(e^x\). (For in depth <em>tutorial</em> follow the Professor’s Penn <em>tutorial</em>, linked above).</p>

\[P_{[1/1]}(x)=\frac{a_0+a_1x}{b_1x+1}\]

<p>To find \(a_0, a_1, b_1\) we need to solve the following system of equations:</p>

\[\begin{cases}
e^0=P(0)=a_0=1 \\
e^0=P'(0)=a_1-b_1=1 \\
e^0=P''(0)=2b_1(b_1-a_1)=1 \\
\end{cases}\]

<p>After solving this, we will get \(P_{[1/1]}=\frac{2+x}{2-x}\).</p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/padeex11.png" alt="img" height="50%" width="50%" /></p>

<p>We can already see that the \(P_{[1/1]}\) follows nicely \(e^x\) for the numbers around \(0\).</p>

<p>\(P_{[2/2]}=\frac{x^2+6x+12}{x^2-6x+12}\) is even better at approximating \(e^x\), at least up to a certain point.</p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/padeex22.png" alt="img" height="50%" width="50%" /></p>

<p>So, in a way, \(e^x \approx \frac{x^2+6x+12}{x^2-6x+12}\) is true for small numbers, just like \(\sin(x) \approx x\) is true for small angles.</p>

<p>Or, even better, \(e^x \approx \frac{-120-60x-12x^{2}-x^{3}}{-120+60x-12x^{2}+x^{3}}\) is true for small small numbers, just like \(\sin(x) \approx x\) is true for small angles.</p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/padeex33.png" alt="img" height="75%" width="75%" /></p>

<p>And it’s get better, for the \(\ln x\) function the equivalent <code class="language-plaintext highlighter-rouge">[2/2]</code> Padé approximation is: \(\frac{3(x-1)(x+1)}{x^{2}+4x+1}\). Notice how the approximation is bad if \(x &lt; 0.5\). For this we should find a better function.</p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/padelog22.png" alt="img" height="75%" width="75%" /></p>

<p>And for \(\sqrt{x}\) the <code class="language-plaintext highlighter-rouge">[2/2]</code> approximation will be \(\frac{5x^{2}+10x+1}{x^{2}+10x+5}\).</p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/padesqrt22.png" alt="img" height="75%" width="75%" /></p>

<h2 id="the-monster-function">The “monster” function</h2>

<p>Putting all together.</p>

<ol>
  <li>To compute \(e^x\) for \(x \in (0,4)\), we use: \(\frac{-120-60x-12x^{2}-x^{3}}{-120+60x-12x^{2}+x^{3}}\).</li>
  <li>To compute \(\ln x\) for \(x \in (0.5, 4)\) we use: \(\frac{3(x-1)(x+1)}{x^{2}+4x+1}\).</li>
  <li>To compute \(\sqrt{x}\) for \(x \in (0, 4)\) we use: \(\frac{5x^{2}+10x+1}{x^{2}+10x+5}\).</li>
</ol>

<p>So for “small numbers” we can approximate \(a^b\) using the following expression:</p>

\[a^b \approx \frac{-120-60[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}-[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}{-120+60[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}+[b*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}\]

<p>Or we can compute:</p>

\[a^{\sqrt{c}} \approx \frac{-120-60[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}-[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}{-120+60[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]-12[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{2}+[\frac{5c^{2}+10c+1}{c^{2}+10c+5}*\frac{3(a-1)(a+1)}{a^{2}+4a+1}]^{3}}\]

<hr />

<h2 id="testing-the-monster-function">Testing the “monster” function</h2>

<p>Now, to test our marvelous approximation, let’s compute \(2^{\sqrt{2}}\):</p>

<ol>
  <li>We start approximating the logarithm: \(\ln 2=\frac{3(2-1)(2+1)}{2^2+8+1}=\frac{3*1*3}{4+8+1}=\frac{9}{13} \approx 0.69\).</li>
  <li>We continue approximating the radical: \(\sqrt{2}=\frac{5*2^2+20+1}{4+20+5}=\frac{20+20+1}{29}=\frac{41}{29} \approx 1.41\)</li>
  <li>We compute the product: \(0.69*1.41 \approx 0.97\).</li>
  <li>We actually compute the power: \(2^{\sqrt{2}}=e^{\sqrt{2}\ln 2} \approx e^{0.97}=\frac{-120-60*(0.97)-12*(0.97)^{2}-(0.97)^{3}}{-120+60*(0.97)-12*(0.97)^{2}+(0.97)^{3}} \approx 2.6612\)</li>
</ol>

<p>The actual result should’ve been: \(2.6651\). Not bad.</p>

<p>Computing \(3^{\sqrt{3}}\) with our function yields: \(6.58\) instead of \(6.70\). Not terrible.</p>

<h2 id="the-deviation-for-01sqrtx-2sqrtx-and-3sqrtx">The deviation for \(0.1^{\sqrt{x}}\), \(2^{\sqrt{x}}\) and \(3^{\sqrt{x}}\)</h2>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/approx01.png" alt="img" height="75%" width="75%" /></p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/approx2.png" alt="img" height="75%" width="75%" /></p>

<p><img src="/assets/images/2024-12-12-a-function-to-approximate-raising-small-numbers-to-small-irrational-powers/approx3.png" alt="img" height="75%" width="75%" /></p>

<h2 id="final-thoughts">Final thoughts</h2>

<ul>
  <li>
    <p>The monster function is impractical, especially after the discovery of the transistor and the logiccd  gates. Even so, the article’s true purpose was to find a goofy pretext to try Padé  Approximations by myself.</p>
  </li>
  <li>
    <p>I was considering applying the same concept that Padé used with polynomials to Fourier series. While others have attempted this, the results aren’t as remarkable. For instance, an expression like \(S_N(x)=a_{0}+\sum_{n=1}{N}(a_n\cos(nx)+b_n\sin(nx))\) is certainly polynomial-like enough to be represented as a rational function.Doing this seems to reduce the Gibbs phenomenon near discontinuities. However, the main drawback is that Padé approximations are not periodic in nature.</p>
  </li>
</ul>


guid: https://simonwillison.net/2024/Dec/20/december-in-llms-has-been-a-lot/#atom-entries
title: December in LLMs has been a lot
author: Simon Willison
url: https://simonwillison.net/2024/Dec/20/december-in-llms-has-been-a-lot/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>I had big plans for December: for one thing, I was hoping to get to an actual RC of Datasette 1.0, in preparation for a full release in January. Instead, I've found myself distracted by a <a href="https://simonwillison.net/search/?tag=llms&amp;year=2024&amp;month=12">constant barrage</a> of new LLM releases.</p>
<p>On December 4th Amazon introduced the <a href="https://simonwillison.net/2024/Dec/4/amazon-nova/"><strong>Amazon Nova family</strong></a> of multi-modal models - clearly priced to compete with the excellent and inexpensive Gemini 1.5 series from Google. I got those working with <a href="https://llm.datasette.io/">LLM</a> via a new <a href="https://github.com/simonw/llm-bedrock">llm-bedrock</a> plugin.</p>
<p>The next big release was <a href="https://simonwillison.net/2024/Dec/6/llama-33/"><strong>Llama 3.3 70B-Instruct</strong></a>, on December 6th. Meta claimed that this 70B model was comparable in quality to their much larger 405B model, and those claims seem to hold weight.</p>
<p>I wrote about how <a href="https://simonwillison.net/2024/Dec/9/llama-33-70b/">I can now run a GPT-4 class model on my laptop</a> - the same laptop that was running a GPT-3 class model just 20 months ago.</p>
<p>Llama 3.3 70B has started showing up from API providers now, including super-fast hosted versions from both <a href="https://groq.com/new-ai-inference-speed-benchmark-for-llama-3-3-70b-powered-by-groq/">Groq</a> (276 tokens/second) and <a href="https://cerebras.ai/inference">Cerebras</a> (a quite frankly absurd 2,200 tokens/second). If you haven't tried Val Town's <a href="https://cerebrascoder.com/">Cerebras Coder</a> demo you really should.</p>
<p>I think the huge gains in model efficiency are one of the defining stories of LLMs in 2024. It's not just the local models that have benefited: the price of proprietary hosted LLMs has dropped through the floor, a result of both competition between vendors and the increasing efficiency of the models themselves.</p>
<p>Last year the running joke was that every time Google put out a new Gemini release OpenAI would ship something more impressive that same day to undermine them.</p>
<p>The tides have turned! This month Google shipped four updates that took the wind out of OpenAI's sails.</p>
<p>The first was <a href="https://simonwillison.net/2024/Dec/6/gemini-exp-1206/"><strong>gemini-exp-1206</strong></a> on December 6th, an experimental model that jumped straight to the top of some of the leaderboards. Was this our first glimpse of Gemini 2.0?</p>
<p>That was followed by <a href="https://simonwillison.net/2024/Dec/11/gemini-2/"><strong>Gemini 2.0 Flash</strong></a> on December 11th, the first official release in Google's Gemini 2.0 series. The streaming support was particularly impressive, with <a href="https://aistudio.google.com/live">https://aistudio.google.com/live</a> demonstrating streaming audio and webcam communication with the multi-modal LLM a full day before OpenAI released their own streaming camera/audio features in an update to ChatGPT.</p>
<p>Then this morning Google shipped <a href="https://simonwillison.net/2024/Dec/19/gemini-thinking-mode/"><strong>Gemini 2.0 Flash "Thinking mode"</strong></a>, their version of the inference scaling technique pioneered by OpenAI's o1. I did <em>not</em> expect Gemini to ship a version of that before 2024 had even ended.</p>
<p>OpenAI have one day left in their <a href="https://openai.com/12-days/">12 Days of OpenAI</a> event. Previous highlights have included the full <strong>o1</strong> model (an upgrade from o1-preview) and <strong>o1-pro</strong>, <a href="https://simonwillison.net/2024/Dec/9/sora/">Sora</a> (later upstaged a week later by Google's <a href="https://simonwillison.net/2024/Dec/16/veo-2/">Veo 2</a>), Canvas (with a confusing <a href="https://simonwillison.net/2024/Dec/10/chatgpt-canvas/">second way to run Python</a>), <a href="https://simonwillison.net/2024/Dec/13/openai-voice-mode-faq/">Advanced Voice with video streaming</a> and Santa and a <em>very</em> cool new <a href="https://simonwillison.net/2024/Dec/17/openai-webrtc/">WebRTC streaming API</a>, ChatGPT Projects (pretty much a direct lift of the similar Claude feature) and the 1-800-CHATGPT phone line.</p>
<p>Tomorrow is the last day. I'm not going to try to predict what they'll launch, but I imagine it will be something notable to close out the year.</p>
<p><strong>Update</strong>: They announced benchmarks for their new o3 model. <a href="https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/">I live-blogged their announcement here</a>.</p>
<h4 id="blog-entries">Blog entries</h4>
<ul>
<li><a href="https://simonwillison.net/2024/Dec/19/gemini-thinking-mode/">Gemini 2.0 Flash "Thinking mode"</a></li>
<li><a href="https://simonwillison.net/2024/Dec/19/one-shot-python-tools/">Building Python tools with a one-shot prompt using uv run and Claude Projects</a></li>
<li><a href="https://simonwillison.net/2024/Dec/11/gemini-2/">Gemini 2.0 Flash: An outstanding multi-modal LLM with a sci-fi streaming mode</a></li>
<li><a href="https://simonwillison.net/2024/Dec/10/chatgpt-canvas/">ChatGPT Canvas can make API requests now, but it's complicated</a></li>
<li><a href="https://simonwillison.net/2024/Dec/9/llama-33-70b/">I can now run a GPT-4 class model on my laptop</a></li>
<li><a href="https://simonwillison.net/2024/Dec/7/prompts-js/">Prompts.js</a></li>
<li><a href="https://simonwillison.net/2024/Dec/4/amazon-nova/">First impressions of the new Amazon Nova LLMs (via a new llm-bedrock plugin)</a></li>
<li><a href="https://simonwillison.net/2024/Nov/27/storing-times-for-human-events/">Storing times for human events</a></li>
<li><a href="https://simonwillison.net/2024/Nov/25/ask-questions-of-sqlite/">Ask questions of SQLite databases and CSV/JSON files in your terminal</a></li>
</ul>
<h4 id="releases">Releases</h4>
<ul>
<li>
<strong><a href="https://github.com/simonw/llm-gemini/releases/tag/0.8">llm-gemini 0.8</a></strong> - 2024-12-19<br />LLM plugin to access Google's Gemini family of models</li>
<li>
<strong><a href="https://github.com/datasette/datasette-enrichments-slow/releases/tag/0.1">datasette-enrichments-slow 0.1</a></strong> - 2024-12-18<br />An enrichment on a slow loop to help debug progress bars</li>
<li>
<strong><a href="https://github.com/simonw/llm-anthropic/releases/tag/0.11">llm-anthropic 0.11</a></strong> - 2024-12-17<br />LLM access to models by Anthropic, including the Claude series</li>
<li>
<strong><a href="https://github.com/simonw/llm-openrouter/releases/tag/0.3">llm-openrouter 0.3</a></strong> - 2024-12-08<br />LLM plugin for models hosted by OpenRouter</li>
<li>
<strong><a href="https://github.com/simonw/prompts-js/releases/tag/0.0.4">prompts-js 0.0.4</a></strong> - 2024-12-08<br />async alternatives to browser alert() and prompt() and confirm()</li>
<li>
<strong><a href="https://github.com/datasette/datasette-enrichments-llm/releases/tag/0.1a0">datasette-enrichments-llm 0.1a0</a></strong> - 2024-12-05<br />Enrich data by prompting LLMs</li>
<li>
<strong><a href="https://github.com/simonw/llm/releases/tag/0.19.1">llm 0.19.1</a></strong> - 2024-12-05<br />Access large language models from the command-line</li>
<li>
<strong><a href="https://github.com/simonw/llm-bedrock/releases/tag/0.4">llm-bedrock 0.4</a></strong> - 2024-12-04<br />Run prompts against models hosted on AWS Bedrock</li>
<li>
<strong><a href="https://github.com/datasette/datasette-queries/releases/tag/0.1a0">datasette-queries 0.1a0</a></strong> - 2024-12-03<br />Save SQL queries in Datasette</li>
<li>
<strong><a href="https://github.com/datasette/datasette-llm-usage/releases/tag/0.1a0">datasette-llm-usage 0.1a0</a></strong> - 2024-12-02<br />Track usage of LLM tokens in a SQLite table</li>
<li>
<strong><a href="https://github.com/simonw/llm-mistral/releases/tag/0.9">llm-mistral 0.9</a></strong> - 2024-12-02<br />LLM plugin providing access to Mistral models using the Mistral API</li>
<li>
<strong><a href="https://github.com/simonw/llm-claude-3/releases/tag/0.10">llm-claude-3 0.10</a></strong> - 2024-12-02<br />LLM plugin for interacting with the Claude 3 family of models</li>
<li>
<strong><a href="https://github.com/simonw/datasette/releases/tag/0.65.1">datasette 0.65.1</a></strong> - 2024-11-29<br />An open source multi-tool for exploring and publishing data</li>
<li>
<strong><a href="https://github.com/simonw/sqlite-utils-ask/releases/tag/0.2">sqlite-utils-ask 0.2</a></strong> - 2024-11-24<br />Ask questions of your data with LLM assistance</li>
<li>
<strong><a href="https://github.com/simonw/sqlite-utils/releases/tag/3.38">sqlite-utils 3.38</a></strong> - 2024-11-23<br />Python CLI utility and library for manipulating SQLite databases</li>
</ul>
<h4 id="tils">TILs</h4>
<ul>
<li>
<a href="https://til.simonwillison.net/python/utc-warning-fix">Fixes for datetime UTC warnings in Python</a> - 2024-12-12</li>
<li>
<a href="https://til.simonwillison.net/npm/npm-publish-github-actions">Publishing a simple client-side JavaScript package to npm with GitHub Actions</a> - 2024-12-08</li>
<li>
<a href="https://til.simonwillison.net/cloudflare/workers-github-oauth">GitHub OAuth for a static site using Cloudflare Workers</a> - 2024-11-29</li>
</ul>


guid: https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/#atom-entries
title: Live blog: the 12th day of OpenAI - "Early evals for OpenAI o3"
author: Simon Willison
url: https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>It's the final day of OpenAI's <a href="https://openai.com/12-days/">12 Days of OpenAI</a> launch series, and since I built <a href="https://til.simonwillison.net/django/live-blog">a live blogging system</a> a couple of months ago I've decided to roll it out again to provide live commentary during the half hour event, which kicks off at <a href="https://www.timeanddate.com/worldclock/fixedtime.html?msg=12th+Day+of+OpenAI&amp;iso=20241220T10&amp;p1=224&amp;am=30">10am San Francisco time</a>.</p>

<p>Here's the <a href="https://www.youtube.com/watch?v=SKBG1sqdyIU">video on YouTube</a>.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/SKBG1sqdyIU?si=ABWW8H90l4LbLvyg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="1"> </iframe>


guid: https://simonwillison.net/2024/Dec/22/link-blog/#atom-entries
title: My approach to running a link blog
author: Simon Willison
url: https://simonwillison.net/2024/Dec/22/link-blog/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>I started running a basic link blog on this domain <a href="https://simonwillison.net/2003/Nov/24/blogmarks/">back in November 2003</a> - publishing links (which I called "blogmarks") with a title, URL, short snippet of commentary and a "via" link where appropriate.</p>
<p>So far I've published <a href="https://simonwillison.net/search/?type=blogmark">7,607 link blog posts</a> and counting.</p>
<p>In April of this year I finally <a href="https://simonwillison.net/2024/Apr/25/blogmarks-that-use-markdown/">upgraded my link blog to support Markdown</a>, allowing me to expand my link blog into something with a lot more room.</p>
<p>The way I use my link blog has evolved substantially in the eight months since then. I'm going to describe the informal set of guidelines I've set myself for how I link blog, in the hope that it might encourage other people to give this a try themselves.</p>
<ul>
  <li><a href="https://simonwillison.net/2024/Dec/22/link-blog/#writing-about-things-i-ve-found">Writing about things I've found</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/22/link-blog/#trying-to-add-something-extra">Trying to add something extra</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/22/link-blog/#the-technology">The technology</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/22/link-blog/#more-people-should-do-this">More people should do this</a></li>
</ul>
<h4 id="writing-about-things-i-ve-found">Writing about things I've found</h4>
<p>Back in November 2022 I wrote <a href="https://simonwillison.net/2022/Nov/6/what-to-blog-about/">What to blog about</a>, which started with this:</p>
<blockquote>
<p>You should start a blog. Having your own little corner of the internet is good for the soul!</p>
</blockquote>
<p>The point of that article was to emphasize that blogging doesn't have to be about unique insights. The value is in writing frequently and having something to show for it over time - worthwhile even if you don't attract much of an audience (or any audience at all).</p>
<p>In that article I proposed two categories of content that are low stakes and high value: <strong>things I learned</strong> and <strong>descriptions of my projects</strong>.</p>
<p>I realize now that link blogging deserves to be included a third category of low stakes, high value writing. We could think of that category as <strong>things I've found</strong>.</p>
<p>That's the purpose of my link blog: it's an ongoing log of things I've found - effectively a combination of public bookmarks and my own thoughts and commentary on why those things are interesting.</p>
<h4 id="trying-to-add-something-extra">Trying to add something extra</h4>
<p>When I first started link blogging I would often post a link with a one sentence summary of the linked content, and maybe a tiny piece of opinionated commentary.</p>
<p>After I upgraded my link blog to support additional markup (links, images, quotations) I decided to be more ambitious. Here are some of the things I try to do:</p>
<ul>
<li>I always include <strong>the names of the people</strong> who created the content I am linking to, if I can figure that out. Credit is really important, and it's also useful for myself because I can later search for someone's name and find other interesting things they have created that I linked to in the past. If I've linked to someone's work three or more times I also try to notice and upgrade them to <a href="https://simonwillison.net/tags/">a dedicated tag</a>.</li>
<li>I try to <strong>add something extra</strong>. My goal with any link blog post is that if you read both my post and the source material you'll have an enhanced experience over if you read just the source material itself.
<ul>
<li>Ideally I'd like you to take something useful away even if you don't follow the link itself. This can be a slightly tricky balance: I don't want to steal attention from the authors and plagiarize their message. Generally I'll try to find some key idea that's worth emphasizing. Slightly cynically, I may try to capture that idea as backup against the original source vanishing from the internet. Link rot is real!</li>
<li>My most basic version of this is trying to provide context as to why I think this particular thing is worth reading - especially important for longer content. A good recent example is my post about Anthropic's <a href="https://simonwillison.net/2024/Dec/20/building-effective-agents/">Building effective agents</a> essay the other day.</li>
<li>I might tie it together to other similar concepts, including things I've written about in the past, for example linking <a href="https://simonwillison.net/2024/Aug/14/prompt-caching-with-claude/">Prompt caching with Claude</a> to my coverage of <a href="https://simonwillison.net/2024/May/14/context-caching-for-google-gemini/">Context caching for Google Gemini</a>.</li>
<li>If part of the material is a video, I might <strong>quote a snippet of the transcript</strong> (often extracted using MacWhisper) like I did in <a href="https://simonwillison.net/2024/Dec/12/clio/">this post about Anthropic's Clio</a>.</li>
<li>A lot of stuff I link to involves programming. I'll often include a <strong>direct link to relevant code</strong>, using the GitHub feature where I can link to a snippet as-of a particular commit. One example is the <a href="https://simonwillison.net/2024/Oct/5/uv-with-github-actions-to-run-an-rss-to-readme-project/">fetch-rss.py link in this post</a>.</li>
</ul>
</li>
<li>I'm liberal with <strong>quotations</strong>. Finding and quoting a paragraph that captures the key theme of a post is a very quick and effective way to summarize it and help people decide if it's worth reading the whole thing. My post on <a href="https://simonwillison.net/2024/Dec/20/openai-o3-breakthrough/">François Chollet's o3 ARC-AGI analysis</a> is an example of that.</li>
<li>If the original author reads my post, I want them to <strong>feel good about it</strong>. I know from my own experience that often when you publish something online the silence can be deafening. Knowing that someone else read, appreciated, understood and then shared your work can be very pleasant.</li>
<li>A slightly self-involved concern I have is that I like to <strong>prove that I've read it</strong>. This is more for me than for anyone else: I don't like to recommend something if I've not read that thing myself, and sticking in a detail that shows I read past the first paragraph helps keep me honest about that.</li>
<li>I've started leaning more into <strong>screenshots</strong> and even short video or audio clips. A screenshot can be considered a visual quotation - I'll sometimes snap these from interesting frames in a YouTube video or live demo associated with the content I'm linking to. I used a screenshot of the Clay debugger in <a href="https://simonwillison.net/2024/Dec/21/clay-ui-library/">my post about Clay</a>.</li>
<p style="margin-top: 0.5em">There are a lot of great link blogs out there, but the one that has influenced me the most in how I approach my own is John Gruber's <a href="https://daringfireball.net/">Daring Fireball</a>. I really like the way he mixes commentary, quotations and value-added relevant information.</p>
</ul>
<h4 id="the-technology">The technology</h4>
<p>The technology behind my link blog is probably the least interesting thing about it. It's part of my <a href="https://github.com/simonw/simonwillisonblog">simonwillisonblog</a> Django application - the main model is called <a href="https://github.com/simonw/simonwillisonblog/blob/c781a1a42ab0a0237f75c7790f069bacc2d70d3f/blog/models.py#L328-L337">Blogmark</a> and it inherits from a <a href="https://github.com/simonw/simonwillisonblog/blob/c781a1a42ab0a0237f75c7790f069bacc2d70d3f/blog/models.py#L172-L203">BaseModel</a> defining things like tags and draft modes that are shared across my other types of content (entries and quotations).</p>
<p>I use the Django Admin to create and edit entries, <a href="https://github.com/simonw/simonwillisonblog/blob/c781a1a42ab0a0237f75c7790f069bacc2d70d3f/blog/admin.py#L73-L76">configured here</a>.</p>
<p>The most cumbersome part of link blogging for me right now is images. I convert these into smaller JPEGs using a <a href="https://tools.simonwillison.net/image-resize-quality">tiny custom tool</a> I built (<a href="https://gist.github.com/simonw/58a06a8028515999e5949a0166cd4c4f">with Claude</a>), then upload them to my <code>static.simonwillison.net</code> S3 bucket using Transmit and drop them into my posts using a Markdown image reference. I generate a first draft of the alt text using a Claude Project with <a href="https://gist.github.com/simonw/1fa7e4e3dcb18fdeca2b3d6ac2c6c628">these custom instructions</a>, then usually make a few changes  before including that in the markup. At some point I'll wire together a UI that makes this process a little smoother.</p>
<p>That <code>static.simonwillison.net</code> bucket is then served via Cloudflare's free tier, which means I effectively never have to think about the cost of serving up those image files.</p>
<p>I wrote up a TIL about <a href="https://til.simonwillison.net/django/building-a-blog-in-django">Building a blog in Django</a> a while ago which describes a similar setup to the one I'm using for my link blog, including how the RSS feed works (using <a href="https://docs.djangoproject.com/en/4.2/ref/contrib/syndication/">Django's syndication framework</a>).</p>
<p>The most technically interesting component is my <a href="https://simonwillison.net/search/?type=blogmark">search feature</a>. I wrote about how that works in <a href="https://simonwillison.net/2017/Oct/5/django-postgresql-faceted-search/">Implementing faceted search with Django and PostgreSQL</a> - the most recent code for that can be found in <a href="https://github.com/simonw/simonwillisonblog/blob/main/blog/search.py">blog/search.py</a> on GitHub.</p>
<p>One of the most useful small enhancements I added was <a href="https://github.com/simonw/simonwillisonblog/issues/488">draft mode</a>, which lets me assign a URL to an item and preview it in my browser without publishing it to the world. This really helps when I am editing posts on my mobile phone as it gives me a reliable preview so I can check for any markup mistakes.</p>
<p>I also send out an approximately weekly <a href="https://simonw.substack.com/">email newsletter</a> version of my blog, for people who want to subscribe in their inbox. This is a straight copy of content from my blog - Substack doesn't have an API for this but their editor does accept copy and paste, so I have a delightful digital duct tape solution for assembling the newsletter which I described in <a href="https://simonwillison.net/2023/Apr/4/substack-observable/">Semi-automating a Substack newsletter with an Observable notebook</a>.</p>
<h4 id="more-people-should-do-this">More people should do this</h4>
<p>I posted this on Bluesky <a href="https://bsky.app/profile/simonwillison.net/post/3ldu6jywnos2j">last night</a>:</p>
<blockquote>
<p>I wish people would post more links to interesting things</p>
<p>I feel like Twitter and LinkedIn and Instagram and TikTok have pushed a lot of people out of the habit of doing that, by penalizing shared links in the various "algorithms"</p>
<p>Bluesky doesn't have that misfeature, thankfully!</p>
<p>(In my ideal world everyone would get their own link blog too, but sharing links on Bluesky and Mastodon is almost as good)</p>
</blockquote>
<p>Sharing interesting links with commentary is a low effort, high value way to contribute to internet life at large.</p>


guid: https://simonwillison.net/2024/Dec/24/qvq/#atom-entries
title: Trying out QvQ - Qwen's new visual reasoning model
author: Simon Willison
url: https://simonwillison.net/2024/Dec/24/qvq/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>I thought we were done for major model releases in 2024, but apparently not: Alibaba's Qwen team just dropped the <s>Apache 2.0 licensed</s> Qwen licensed (<a href="https://simonwillison.net/2024/Dec/24/qvq/#the-license-changed">the license changed</a>)  QvQ-72B-Preview, "an experimental research model focusing on enhancing visual reasoning capabilities".</p>
<p>Their blog post is titled <a href="https://qwenlm.github.io/blog/qvq-72b-preview/">QvQ: To See the World with Wisdom</a> - similar flowery language to their QwQ announcement <a href="https://qwenlm.github.io/blog/qwq-32b-preview/">QwQ: Reflect Deeply on the Boundaries of the Unknown</a> a few weeks ago in November.</p>
<p>It's a vision-focused follow-up to QwQ, which I <a href="https://simonwillison.net/2024/Nov/27/qwq/">wrote about previousy</a>. QwQ is an impressive openly licensed inference-scaling model: give it a prompt and it will think out loud over many tokens while trying to derive a good answer, similar to OpenAI's o1 and o3 models.</p>
<p>The new QvQ adds vision to the mix. You can try it out <a href="https://huggingface.co/spaces/Qwen/QVQ-72B-preview">on Hugging Face Spaces</a> - it accepts an image and a single prompt and then streams out a <em>very</em> long response where it thinks through the problem you have posed it. There's no option to send a follow-up prompt.</p>
<p>I've tried it out with a bunch of things, with mixed results - but it's really fun seeing how it works through a problem.</p>
<p>My most successful prompt was "Count the pelicans" with this image:</p>
<p><img src="https://static.simonwillison.net/static/2024/count-pelicans-easy.jpg" alt="A photograph of four glorious young California Brown Pelicans perched on a dock. The back end of another pelican is visible at the front of the photo." style="max-width: 100%;" /></p>
<p>Here's <a href="https://gist.github.com/simonw/6c296f4b9323736dc77978447b6368fc#response">the full response</a>. Some highlights:</p>
<blockquote>
<p>So I've got this picture of some pelicans, and I need to count them. Let me see... First off, I know that pelicans are those big birds with the massive beaks, right? [...]</p>
<p>Let me try counting again, more carefully this time. Starting from the left:</p>
<ol>
<li>The first pelican is fully visible, standing at the front.</li>
<li>Behind it, slightly to the right, is the second pelican.</li>
<li>Then, further back, there's a third pelican.</li>
<li>And next to that one, there's a fourth pelican.</li>
</ol>
<p>So, that's four pelicans in total. But, I notice that on the far right of the image, there's part of another bird, maybe a pelican's back or tail feathers, but it's not fully in the frame, so I don't think I should count it as a whole pelican.</p>
</blockquote>
<p>Something about the tone of voice it uses, "First off, I know that pelicans are those big birds with the massive beaks, right?", tickles me.</p>
<p>I also tried this on a <a href="https://gist.github.com/simonw/6c296f4b9323736dc77978447b6368fc#image-2">much harder image</a> - it counted 17 which looks about right to me but honestly I have trouble with that image myself.</p>
<p>I fed in <a href="https://gist.github.com/simonw/6c296f4b9323736dc77978447b6368fc#arc-agi-puzzle-0d87d2a6">one of the ARC-AGI puzzles</a> that o3 had failed at.</p>
<p><img alt="A puzzle with colored squares, where drawing a line between the single blue squares and turning any intersected rectangles blue is clearly the solution." src="https://static.simonwillison.net/static/2024/arc-agi-task-0d87d2a6.png" style="max-width: 100%;" /></p>
<p>It produced <a href="https://gist.github.com/simonw/6c296f4b9323736dc77978447b6368fc#response-1">a very lengthy chain of thought</a> that was almost entirely incorrect, but had some interesting "ideas" in it:</p>
<blockquote>
<p>[...] Let me try to think in terms of cellular automata rules, like Conway's Game of Life.</p>
<p>In Game of Life, each cell's state in the next generation is determined by its current state and the states of its eight neighbors.</p>
<p>Perhaps a similar rule applies here.</p>
</blockquote>
<p>Finally, I asked it to "Estimate the height of the dinosaur" against this image (which, as it correctly noted, is actually an inflatable dragon):</p>
<p><img src="https://static.simonwillison.net/static/2024/inflatable-dragon.jpg" alt="A large inflatable Christmas decoration of a reindeer riding a dragon - both reindeer and dragon are wearing Christmas hats" style="max-width: 100%;" /></p>
<p>I'm not sure this task is even possible given the lack of items in the frame of comparable known height. It <a href="https://gist.github.com/simonw/6c296f4b9323736dc77978447b6368fc#response-3">had a good go at it</a> though! I particularly enjoyed how it began:</p>
<blockquote>
<p>So I've got this inflatable Christmas decoration, and it's a dragon! But not just any dragon—it's a green dragon wearing a Santa hat and a red and white scarf. And get this, there's a reindeer on its back, also wearing a Santa hat and holding onto the dragon's wings. It's pretty festive and colorful, with lots of vibrant greens, reds, and yellows.</p>
<p>The dragon has these big, friendly eyes and a smiling face, which makes it look really cheerful. Its wings are spread out, and it has white claws on its feet. The reindeer is brown with antlers and seems to be enjoying the ride on the dragon's back.</p>
<p>Now, the question is, how tall is this inflatable dragon? I need to estimate its height. Let me see. I'm standing next to it, and I'm about 5 feet 10 inches tall. The dragon is definitely taller than me. Maybe around 8 or 9 feet high? But I should try to be more precise.</p>
</blockquote>
<p>I wonder how it decided that its own height was 5 feet 10 inches!</p>
<h4 id="running-qvq-locally">Running QvQ locally</h4>
<p>All of my experiments so far have used the <a href="https://huggingface.co/spaces/Qwen/QVQ-72B-preview">hosted Hugging Face demo</a>. I'm hoping to try it out on my own laptop soon - I think it should just fit in 64GB of M2, maybe with a smaller quantization.</p>
<p>Right now the options are:</p>
<ul>
<li>
<a href="https://huggingface.co/Qwen/QVQ-72B-Preview">Qwen/QVQ-72B-Preview</a> on Hugging Face has the GPU model weights, for use with Hugging Face Transformers and the <a href="https://pypi.org/project/qwen-vl-utils/">qwen-vl-utils</a> Python package.</li>
<li>Prince Canuma <a href="https://twitter.com/Prince_Canuma/status/1871687356815716672">converted the model for Apple's MLX framework</a> as <a href="https://huggingface.co/collections/mlx-community/qvq-72b-preview-676b345a6f93172ba980c0d5">mlx-community/qvq-72b-preview</a> and got it working with his excellent <a href="https://github.com/Blaizzy/mlx-vlm">mlx-vlm</a> package.</li>
</ul>
<p>As a happy user of Ollama's <a href="https://ollama.com/library/qwq">qwq port</a> I'm hoping they add a QvQ release at some point soon as well.</p>
<h4 id="with-mlx-vlm">Running QvQ on my Mac using mlx-vlm</h4>
<p><strong>Update</strong>: I successfully ran QvQ on my 64GB M2 MacBook Pro using Prince Canuma's <code>mlx-vlm</code> via <code>uv run </code> with the following command:</p>
<div class="highlight highlight-source-shell"><pre>uv run --with <span class="pl-s"><span class="pl-pds">'</span>numpy&lt;2.0<span class="pl-pds">'</span></span> --with mlx-vlm python \
  -m mlx_vlm.generate \
    --model mlx-community/QVQ-72B-Preview-4bit \
    --max-tokens 10000 \
    --temp 0.0 \
    --prompt <span class="pl-s"><span class="pl-pds">"</span>describe this<span class="pl-pds">"</span></span> \
    --image pelicans-on-bicycles-veo2.jpg</pre></div>
<p>My image input here was taken from my experiment with Google's <a href="https://simonwillison.net/2024/Dec/16/veo-2/">Veo 2</a> video generation model:</p>
<p><img src="https://static.simonwillison.net/static/2024/pelicans-on-bicycles-veo2.jpg" alt="A screenshot of the Google VideoFX video generation tool" style="max-width: 100%;" /></p>
<p>Here's the full output from running that command, after it first downloaded 38GB to <code>~/.cache/huggingface/hub/models--mlx-community--QVQ-72B-Preview-4bi</code>:</p>
<pre><code>==========
Image: ['pelicans-on-bicycles-veo2.jpg'] 

Prompt: &lt;|im_start|&gt;system
You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.&lt;|im_end|&gt;
&lt;|im_start|&gt;user
describe this&lt;|vision_start|&gt;&lt;|image_pad|&gt;&lt;|vision_end|&gt;&lt;|im_end|&gt;
&lt;|im_start|&gt;assistant

Alright, I've got this "Text to Video" tool to explore. It seems pretty advanced, allowing me to turn text descriptions into actual videos. The interface looks user-friendly, with a dark theme that's easy on the eyes. On the left side, there's a panel where I can input my text prompt. It already has an example filled in: "A pelican riding a bicycle along a coastal path overlooking a harbor."

That sounds interesting! I can see four different video thumbnails on the right side, each showing variations of this scene. One of them even has the pelican wearing a helmet, which adds a humorous touch. Another shows the pelican standing next to a bicycle, almost as if it's ready to hop on and start pedaling.

Below the text input, there are some style options like "photorealistic," "35mm film," "minimal," "sketchy," "handmade," and "abstract." These probably let me choose the visual style of the video. For now, I'll stick with the default settings.

At the bottom of the left panel, there are two buttons: "Start over" and "Create videos." I guess "Create videos" is the one I need to press to generate the videos based on my text prompt.

Let me think about this. I want to see what kind of videos this tool can produce based on my description. The example prompt is already filled in, so maybe I should just go ahead and click "Create videos" to see what happens.

Wait a minute, the prompt mentions a coastal path overlooking a harbor. In the thumbnails, I can see a background with water and boats, which matches the description. It's cool how the tool has interpreted the text into visual elements.

I should also pay attention to the "Visual Prompt" section, which says "View only." That probably means I can't edit it directly, but I can view the generated videos based on this prompt.

Hmm, maybe I should try changing the prompt to see different results. For example, instead of a pelican riding a bicycle, maybe I could describe a different scene. But for now, I'll stick with the given example to understand how it works.

After clicking "Create videos," I expect to see the videos being generated. There might be a loading process, depending on the complexity of the prompt and the tool's processing speed.

Once the videos are ready, I can preview them to see how well they match my description. If I'm not satisfied, I can always go back and adjust the prompt or try different style options.

Overall, this seems like a powerful tool for creating custom videos based on textual descriptions. It could be really useful for storytelling, presentations, or even just for fun, experimenting with different scenes and styles.

I think I'll spend some time exploring the different style options to see how they affect the final videos. For instance, selecting "35mm film" might give the videos a vintage, cinematic look, while "abstract" could produce more artistic and less realistic visuals.

Also, I wonder if there's a way to customize more specific aspects, like the camera angle, lighting, or movement. Maybe after generating the initial videos, there are additional editing options available.

In summary, I'm excited to use this Text to Video tool and see what kind of creative possibilities it opens up. With a bit of practice, I could probably create some impressive visual content just by describing what I want to see.

**Final Answer**

To proceed with generating videos based on the provided text prompt, I need to click on the "Create videos" button. This action will initiate the process of converting the textual description into visual content, resulting in multiple video thumbnails that can be previewed for further use or adjustments.
==========
Prompt: 0.870 tokens-per-sec
Generation: 7.694 tokens-per-sec
</code></pre>

<h4 id="the-license-changed">The license changed from Apache 2.0 to Qwen</h4>
<p>When I wrote this post yesterday the LICENSE file in the Hugging Face repository was Apache 2.0. Just after midnight UTC on 25th December <a href="https://huggingface.co/Qwen/QVQ-72B-Preview/commit/53b19b90d67220c896e868a809ef1b93d0c8dab8">this commit</a> landed updating the  <code>QVQ-72B-Preview</code> license file to the <a href="https://huggingface.co/Qwen/QVQ-72B-Preview/blob/main/LICENSE">Qwen license</a> instead.</p>
<p>This looks to me like they were correcting a mistake, not changing their policy. The <a href="https://huggingface.co/Qwen/QVQ-72B-Preview/blob/main/README.md">README.md</a> for that repository has this block of YAML:</p>
<pre><code>license: other
license_name: qwen
</code></pre>
<p>And <a href="https://huggingface.co/Qwen/QVQ-72B-Preview/commits/main/README.md">commits to that README</a> at one point linked to the <a href="https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/LICENSE">Qwen2.5-72B-Instruct copy of the Qwen license</a>.</p>
<p>The QwQ model repository <a href="https://huggingface.co/Qwen/QwQ-32B-Preview/blob/main/LICENSE">continues to list Apache 2.0</a>, which matches the YAML in <a href="https://huggingface.co/Qwen/QwQ-32B-Preview/blob/main/README.md">its README</a> as well.</p>
<p>So it looks to me like the intention is for QvQ and Qwen2.5-72B-Instruct to be Qwen licensed, while QwQ is Apache 2.0.</p>


guid: https://simonwillison.net/2024/Dec/31/llms-in-2024/#atom-entries
title: Things we learned about LLMs in 2024
author: Simon Willison
url: https://simonwillison.net/2024/Dec/31/llms-in-2024/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>A <em>lot</em> has happened in the world of Large Language Models over the course of 2024. Here's a review of things we figured out about the field in the past twelve months, plus my attempt at identifying key themes and pivotal moments.</p>
<p>This is a sequel to <a href="https://simonwillison.net/2023/Dec/31/ai-in-2023/">my review of 2023</a>.</p>
<p>In this article:</p>
<ul>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#the-gpt-4-barrier-was-comprehensively-broken">The GPT-4 barrier was comprehensively broken</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#some-of-those-gpt-4-models-run-on-my-laptop">Some of those GPT-4 models run on my laptop</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#llm-prices-crashed-thanks-to-competition-and-increased-efficiency">LLM prices crashed, thanks to competition and increased efficiency</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#multimodal-vision-is-common-audio-and-video-are-starting-to-emerge">Multimodal vision is common, audio and video are starting to emerge</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#voice-and-live-camera-mode-are-science-fiction-come-to-life">Voice and live camera mode are science fiction come to life</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#prompt-driven-app-generation-is-a-commodity-already">Prompt driven app generation is a commodity already</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#universal-access-to-the-best-models-lasted-for-just-a-few-short-months">Universal access to the best models lasted for just a few short months</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#-agents-still-haven-t-really-happened-yet">"Agents" still haven't really happened yet</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#evals-really-matter">Evals really matter</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#apple-intelligence-is-bad-apple-s-mlx-library-is-excellent">Apple Intelligence is bad, Apple's MLX library is excellent</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#the-rise-of-inference-scaling-reasoning-models">The rise of inference-scaling "reasoning" models</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#was-the-best-currently-available-llm-trained-in-china-for-less-than-6m-">Was the best currently available LLM trained in China for less than $6m?</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#the-environmental-impact-got-better">The environmental impact got better</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#the-environmental-impact-got-much-much-worse">The environmental impact got much, much worse</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#the-year-of-slop">The year of slop</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#synthetic-training-data-works-great">Synthetic training data works great</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#llms-somehow-got-even-harder-to-use">LLMs somehow got even harder to use</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#knowledge-is-incredibly-unevenly-distributed">Knowledge is incredibly unevenly distributed</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#llms-need-better-criticism">LLMs need better criticism</a></li>
  <li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#everything-tagged-llms-on-my-blog-in-2024">Everything tagged "llms" on my blog in 2024</a></li>
</ul>
<h4 id="the-gpt-4-barrier-was-comprehensively-broken">The GPT-4 barrier was comprehensively broken</h4>
<p>In my December 2023 review I wrote about how <a href="https://simonwillison.net/2023/Dec/31/ai-in-2023/#cant-build-gpt4">We don’t yet know how to build GPT-4</a> - OpenAI's best model was almost a year old at that point, yet no other AI lab had produced anything better. What did OpenAI know that the rest of us didn't?</p>
<p>I'm relieved that this has changed completely in the past twelve months. 18 organizations now have models on the <a href="https://lmarena.ai/?leaderboard">Chatbot Arena Leaderboard</a> that rank higher than the original GPT-4 from March 2023 (<code>GPT-4-0314</code> on the board) - 70 models in total.</p>
<p><img src="https://static.simonwillison.net/static/2024/arena-dec-2024.jpg" alt="Screenshot of a comparison table showing AI model rankings. Table headers: Rank (UB), Rank (StyleCtrl), Model, Arena Score, 95% CI, Votes, Organization, License. Shows 12 models including GLM-4-0520, Llama-3-70B-Instruct, Gemini-1.5-Flash-8B-Exp-0827, with rankings, scores, and licensing details. Models range from rank 52-69 with Arena scores between 1186-1207." style="max-width: 100%;" /></p>
<p>The earliest of those was <strong>Google's Gemini 1.5 Pro</strong>, released in February. In addition to producing GPT-4 level outputs, it introduced several brand new capabilities to the field - most notably its 1 million (and then later 2 million) token input context length, and the ability to input video.</p>
<p>I wrote about this at the time in <a href="https://simonwillison.net/2024/Feb/21/gemini-pro-video/">The killer app of Gemini Pro 1.5 is video</a>, which earned me a short appearance <a href="https://www.youtube.com/watch?v=XEzRZ35urlk&amp;t=606s">as a talking head</a> in the Google I/O opening keynote in May.</p>
<p>Gemini 1.5 Pro also illustrated one of the key themes of 2024: <strong>increased context lengths</strong>. Last year most models accepted 4,096 or 8,192 tokens, with the notable exception of Claude 2.1 which <a href="https://www.anthropic.com/news/claude-2-1">accepted 200,000</a>. Today every serious provider has a 100,000+ token model, and Google's Gemini series accepts up to 2 million.</p>
<p>Longer inputs dramatically increase the scope of problems that can be solved with an LLM: you can now throw in an entire book and ask questions about its contents, but more importantly you can feed in a <em>lot</em> of example code to help the model correctly solve a coding problem. LLM use-cases that involve long inputs are far more interesting to me than short prompts that rely purely on the information already baked into the model weights. Many of my <a href="https://simonwillison.net/tags/tools/">tools</a> were built using this pattern.</p>
<p>Getting back to models that beat GPT-4: Anthropic's Claude 3 series <a href="https://simonwillison.net/2024/Mar/4/claude-3/">launched in March</a>, and Claude 3 Opus quickly became my new favourite daily-driver. They upped the ante even more in June with <a href="https://simonwillison.net/2024/Jun/20/claude-35-sonnet/">the launch of Claude 3.5 Sonnet</a> - a model that is still my favourite six months later (though it got a significant upgrade <a href="https://www.anthropic.com/news/3-5-models-and-computer-use">on October 22</a>, confusingly keeping the same 3.5 version number. Anthropic fans have since taken to calling it Claude 3.6).</p>
<p>Then there's the rest. If you browse <a href="https://lmarena.ai/?leaderboard">the Chatbot Arena leaderboard</a> today - still the most useful single place to get <a href="https://simonwillison.net/2024/Jul/14/pycon/#pycon-2024.016.jpeg">a vibes-based evaluation</a> of models - you'll see that GPT-4-0314 has fallen to around 70th place. The 18 organizations with higher scoring models are Google, OpenAI, Alibaba, Anthropic, Meta, Reka AI, 01 AI, Amazon, Cohere, DeepSeek, Nvidia, Mistral, NexusFlow, Zhipu AI, xAI, AI21 Labs, Princeton and Tencent.</p>
<p>Training a GPT-4 beating model was a huge deal in 2023. In 2024 it's an achievement that isn't even particularly notable, though I personally still celebrate any time a new organization joins that list.</p>
<h4 id="some-of-those-gpt-4-models-run-on-my-laptop">Some of those GPT-4 models run on my laptop</h4>
<p>My personal laptop is a 64GB M2 MacBook Pro from 2023. It's a powerful machine, but it's also nearly two years old now - and crucially it's the same laptop I've been using ever since I first ran an LLM on my computer back in March 2023 (see <a href="https://simonwillison.net/2023/Mar/11/llama/">Large language models are having their Stable Diffusion moment</a>).</p>
<p>That same laptop that could just about run a GPT-3-class model in March last year has now run multiple GPT-4 class models! Some of my notes on that:</p>
<ul>
<li>
<a href="https://simonwillison.net/2024/Nov/12/qwen25-coder/">Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac</a> talks about Qwen2.5-Coder-32B in November - an Apache 2.0 licensed model!</li>
<li>
<a href="https://simonwillison.net/2024/Dec/9/llama-33-70b/">I can now run a GPT-4 class model on my laptop</a> talks about running Meta's Llama 3.3 70B (released in December)</li>
</ul>
<p>This remains astonishing to me. I thought a model with the capabilities and output quality of GPT-4 needed a datacenter class server with one or more $40,000+ GPUs.</p>
<p>These models take up enough of my 64GB of RAM that I don't run them often - they don't leave much room for anything else.</p>
<p>The fact that they run at all is a testament to the incredible training and inference performance gains that we've figured out over the past year. It turns out there was a <em>lot</em> of low-hanging fruit to be harvested in terms of model efficiency. I expect there's still more to come.</p>
<p>Meta's Llama 3.2 models deserve a special mention. They may not be GPT-4 class, but at 1B and 3B sizes they punch <em>massively</em> above their weight. I run Llama 3.2 3B on my iPhone using the free <a href="https://apps.apple.com/us/app/mlc-chat/id6448482937">MLC Chat iOS app</a> and it's a shockingly capable model for its tiny (&lt;2GB) size. Try firing it up and asking it for "a plot outline of a Netflix Christmas movie where a data journalist falls in love with a local ceramacist". Here's what I got, at a respectable 20 tokens per second:</p>
<p><img src="https://static.simonwillison.net/static/2024/mlc-chat-christmas.jpg" alt="MLC Chat: Llama - [System] Ready to chat. a plot outline of a Netflix Christmas movie where a data journalist falls in love with a local ceramacist. Show as Markdown is turned on. Here's a plot outline for a Netflix Christmas movie: Title: &quot;Love in the Clay&quot; Plot Outline: We meet our protagonist, JESSICA, a data journalist who has just returned to her hometown of Willow Creek, a small, charming town nestled in the snow-covered mountains. She's back to work on a story about the town's history and the effects of gentrification on the local community." style="max-width: 100%;" /></p>
<p><a href="https://gist.github.com/simonw/7db8d582fdb0c133d7e05205c305d5bd">Here's the rest of the transcript</a>. It's bland and generic, but my phone can pitch bland and generic Christmas movies to Netflix now!</p>
<h4 id="llm-prices-crashed-thanks-to-competition-and-increased-efficiency">LLM prices crashed, thanks to competition and increased efficiency</h4>
<p>The past twelve months have seen a dramatic collapse in the cost of running a prompt through the top tier hosted LLMs.</p>
<p>In December 2023 (here's the <a href="https://web.archive.org/web/20231214190432/https://openai.com/pricing">Internet Archive for the OpenAI pricing page</a>) OpenAI were charging $30/million input tokens for GPT-4, $10/mTok for the then-new GPT-4 Turbo and $1/mTok for GPT-3.5 Turbo.</p>
<p>Today $30/mTok gets you OpenAI's most expensive model, o1. GPT-4o is $2.50 (12x cheaper than GPT-4) and GPT-4o mini is $0.15/mTok - nearly 7x cheaper than GPT-3.5 and <em>massively</em> more capable.</p>
<p>Other model providers charge even less. Anthropic's Claude 3 Haiku (from March, but still their cheapest model) is $0.25/mTok. Google's Gemini 1.5 Flash is $0.075/mTok and their Gemini 1.5 Flash 8B is $0.0375/mTok - that's 27x cheaper than GPT-3.5 Turbo last year.</p>
<p>I've been tracking these pricing changes under my <a href="https://simonwillison.net/tags/llm-pricing/">llm-pricing tag</a>.</p>
<p>These price drops are driven by two factors: increased competition and increased efficiency. The efficiency thing is <em>really</em> important for everyone who is concerned about the environmental impact of LLMs. These price drops tie directly to how much energy is being used for running prompts.</p>
<p>There's still plenty to worry about with respect to the environmental impact of the great AI datacenter buildout, but a lot of the concerns over the energy cost of individual prompts are no longer credible.</p>
<p>Here's a fun napkin calculation: how much would it cost to generate short descriptions of every one of the 68,000 photos in my personal photo library using Google's Gemini 1.5 Flash 8B (<a href="https://developers.googleblog.com/en/gemini-15-flash-8b-is-now-generally-available-for-use/">released in October</a>), their cheapest model?</p>
<p>Each photo would need 260 input tokens and around 100 output tokens.</p>
<p>260 * 68,000 = 17,680,000 input tokens<br />
17,680,000 * $0.0375/million = $0.66<br />
100 * 68,000 = 6,800,000 output tokens<br />
6,800,000 * $0.15/million = $1.02<br /></p>
<p>That's a total cost of <strong>$1.68</strong> to process 68,000 images. That's so absurdly cheap I had to run the numbers three times to confirm I got it right.</p>
<p>How good are those descriptions? Here's what I got from this command:</p>
<pre><code>llm -m gemini-1.5-flash-8b-latest describe -a IMG_1825.jpeg
</code></pre>
<p>Against this photo of butterflies at the California Academy of Sciences:</p>
<p><img src="https://static.simonwillison.net/static/2024/butterflies.jpg" alt="A photo of two butterflies feeding on a red tray" style="max-width: 100%;" /></p>
<blockquote>
<p>A shallow dish, likely a hummingbird or butterfly feeder, is red.  Pieces of orange slices of fruit are visible inside the dish.</p>
<p>Two butterflies are positioned in the feeder, one is a dark brown/black butterfly with white/cream-colored markings.  The other is a large, brown butterfly with patterns of lighter brown, beige, and black markings, including prominent eye spots. The larger brown butterfly appears to be feeding on the fruit.</p>
</blockquote>
<p>260 input tokens, 92 output tokens. Cost approximately 0.0024 cents (that's less than a 400th of a cent).</p>
<p>This increase in efficiency and reduction in price is my single favourite trend from 2024. I want the utility of LLMs at a fraction of the energy cost and it looks like that's what we're getting.</p>
<h4 id="multimodal-vision-is-common-audio-and-video-are-starting-to-emerge">Multimodal vision is common, audio and video are starting to emerge</h4>
<p>My butterfly example above illustrates another key trend from 2024: the rise of multi-modal LLMs.</p>
<p>A year ago the single most notable example of these was GPT-4 Vision, <a href="https://openai.com/index/new-models-and-developer-products-announced-at-devday/">released at OpenAI's DevDay in November 2023</a>. Google's multi-modal Gemini 1.0 was announced <a href="https://blog.google/technology/ai/google-gemini-ai/">on December 7th 2023</a> so it also (just) makes it into the 2023 window.</p>
<p>In 2024, almost every significant model vendor released multi-modal models. We saw the Claude 3 series from Anthropic <a href="https://simonwillison.net/2024/Mar/4/claude-3/">in March</a>, Gemini 1.5 Pro <a href="https://simonwillison.net/2024/Apr/10/gemini-15-pro-public-preview/">in April</a> (images, audio and video), then September brought <a href="https://simonwillison.net/2024/Sep/4/qwen2-vl/">Qwen2-VL</a> and Mistral's <a href="https://simonwillison.net/2024/Sep/11/pixtral/">Pixtral 12B</a> and Meta's <a href="https://simonwillison.net/2024/Sep/25/llama-32/">Llama 3.2 11B and 90B vision models</a>. We got audio input and output <a href="https://simonwillison.net/2024/Oct/18/openai-audio/">from OpenAI in October</a>, then November saw <a href="https://simonwillison.net/2024/Nov/28/smolvlm/">SmolVLM from Hugging Face</a> and December saw image and video models <a href="https://simonwillison.net/2024/Dec/4/amazon-nova/">from Amazon Nova</a>.</p>
<p>In October I <a href="https://simonwillison.net/2024/Oct/29/llm-multi-modal/">upgraded my LLM CLI tool to support multi-modal models via attachments</a>. It now has plugins for a whole collection of different vision models.</p>
<p>I think people who complain that LLM improvement has slowed are often missing the enormous advances in these multi-modal models. Being able to run prompts against images (and audio and video) is a fascinating new way to apply these models.</p>
<h4 id="voice-and-live-camera-mode-are-science-fiction-come-to-life">Voice and live camera mode are science fiction come to life</h4>
<p>The audio and live video modes that have started to emerge deserve a special mention.</p>
<p>The ability to talk to ChatGPT first arrived <a href="https://openai.com/index/chatgpt-can-now-see-hear-and-speak/">in September 2023</a>, but it was mostly an illusion: OpenAI used their excellent Whisper speech-to-text model and a new text-to-speech model (creatively named <a href="https://platform.openai.com/docs/models#tts">tts-1</a>) to enable conversations with the ChatGPT mobile apps, but the actual model just saw text.</p>
<p>The <a href="https://openai.com/index/hello-gpt-4o/">May 13th</a> announcement of GPT-4o included a demo of a brand new voice mode, where the true multi-modal GPT-4o (the o is for "omni") model could accept audio input and output incredibly realistic sounding speech without needing separate TTS or STT models.</p>
<p>The demo also sounded <a href="https://www.nytimes.com/2024/05/20/technology/scarlett-johansson-openai-statement.html">conspicuously similar to Scarlett Johansson</a>... and after she complained the voice from the demo, Skye, never made it to a production product.</p>
<p>The delay in releasing the new voice mode after the initial demo caused quite a lot of confusion. I wrote about that in <a href="https://simonwillison.net/2024/May/15/chatgpt-in-4o-mode/">ChatGPT in “4o” mode is not running the new features yet</a>.</p>
<p>When ChatGPT Advanced Voice mode finally <em>did</em> roll out (a slow roll from August through September) it was spectacular. I've been using it extensively on walks with my dog and it's amazing how much the improvement in intonation elevates the material. I've also had a lot of fun <a href="https://simonwillison.net/2024/Oct/18/openai-audio/">experimenting with the OpenAI audio APIs</a>.</p>
<p>Even more fun: Advanced Voice mode can do accents! Here's what happened when I told it <a href="https://simonwillison.net/2024/Oct/26/russian-spanish-pelican/">I need you to pretend to be a California brown pelican with a very thick Russian accent, but you talk to me exclusively in Spanish</a>.</p>
<p><audio controls="controls" style="width: 100%">
<source src="https://static.simonwillison.net/static/2024/russian-pelican-in-spanish.mp3" type="audio/mp3" />
Your browser does not support the audio element.
</audio></p>
<p>OpenAI aren't the only group with a multi-modal audio model. Google's Gemini also accepts audio input, and the Google Gemini apps can speak in a similar way to ChatGPT now. Amazon also pre-announced voice mode <a href="https://simonwillison.net/2024/Dec/4/amazon-nova/#gamoa">for Amazon Nova</a>, but that's meant to roll out in Q1 of 2025.</p>
<p>Google's NotebookLM, released <a href="https://simonwillison.net/2024/Sep/29/notebooklm-audio-overview/">in September</a>, took audio output to a new level by producing spookily realistic conversations between two "podcast hosts" about anything you fed into their tool. They later added custom instructions, so naturally <a href="https://simonwillison.net/2024/Oct/17/notebooklm-pelicans/">I turned them into pelicans</a>:</p>
<audio controls="controls" style="width: 100%">
<source src="https://static.simonwillison.net/static/2024/video-scraping-pelicans.mp3" type="audio/mp3" />
Your browser does not support the audio element.
</audio>
<p>The most recent twist, again from December (December was <a href="https://simonwillison.net/2024/Dec/20/december-in-llms-has-been-a-lot/">a lot</a>) is live video. ChatGPT voice mode now provides the option to share your camera feed with the model and talk about what you can see in real time. Google Gemini have <a href="https://simonwillison.net/2024/Dec/11/gemini-2/#the-streaming-api-is-next-level">a preview of the same feature</a>, which they managed to ship the day before ChatGPT did.</p>
<lite-youtube videoid="mpgWH9KulUU"
  title="Gemini 2.0 streaming demo"
  playlabel="Play: Gemini 2.0 streaming demo">
</lite-youtube>
<p style="margin-top: 1em">These abilities are just a few weeks old at this point, and I don't think their impact has been fully felt yet. If you haven't tried them out yet you really should.</p>
<p>Both Gemini and OpenAI offer API access to these features as well. OpenAI started with <a href="https://simonwillison.net/2024/Oct/2/not-digital-god/#gpt-4o-audio-via-the-new-websocket-realtime-api">a WebSocket API</a> that was quite challenging to use, but in December they announced <a href="https://simonwillison.net/2024/Dec/17/openai-webrtc/">a new WebRTC API</a> which is much easier to get started with. Building a web app that a user can talk to via voice is <em>easy</em> now!</p>
<h4 id="prompt-driven-app-generation-is-a-commodity-already">Prompt driven app generation is a commodity already</h4>
<p>This was possible with GPT-4 in 2023, but the value it provides became evident in 2024.</p>
<p>We already knew LLMs were <a href="https://simonwillison.net/2023/Dec/31/ai-in-2023/#code-best-application">spookily good at writing code</a>. If you prompt them right, it turns out they can build you <strong>a full interactive application</strong> using HTML, CSS and JavaScript (and tools like React if you wire up some extra supporting build mechanisms) - often in a single prompt.</p>
<p>Anthropic kicked this idea into high gear when they released <strong>Claude Artifacts</strong>, a groundbreaking new feature that was initially slightly lost in the noise due to being described half way through <a href="https://www.anthropic.com/news/claude-3-5-sonnet">their announcement of the incredible Claude 3.5 Sonnet</a>.</p>
<p>With Artifacts, Claude can write you an on-demand interactive application and then <em>let you use it</em> directly inside the Claude interface.</p>
<p>Here's my <a href="https://tools.simonwillison.net/extract-urls">Extract URLs</a> app, entirely <a href="https://gist.github.com/simonw/0a7d0ddeb0fdd63a844669475778ca06">generated by Claude</a>:</p>
<p><img src="https://static.simonwillison.net/static/2024/claude-artifacts/extract-urls.jpg" alt="Extract URLs tool. Content pasted. URLs extracted. Shows a list of extracted URLs." style="max-width: 100%;" /></p>
<p>I've found myself using this <em>a lot</em>. I noticed how much I was relying on it in October and wrote <a href="https://simonwillison.net/2024/Oct/21/claude-artifacts/">Everything I built with Claude Artifacts this week</a>, describing 14 little tools I had put together in a seven day period.</p>
<p>Since then, a whole bunch of other teams have built similar systems. GitHub announced their version of this - <a href="https://simonwillison.net/2024/Oct/30/copilot-models/">GitHub Spark</a> - in October. Mistral Chat <a href="https://mistral.ai/news/mistral-chat/">added it as a feature called Canvas</a> in November.</p>
<p>Steve Krouse from Val Town <a href="https://simonwillison.net/2024/Oct/31/cerebras-coder/">built a version of it against Cerebras</a>, showcasing how a 2,000 token/second LLM can iterate on an application with changes visible in less than a second.</p>
<p>Then in December, the Chatbot Arena team introduced <a href="https://simonwillison.net/2024/Dec/16/webdev-arena/">a whole new leaderboard</a> for this feature, driven by users building the same interactive app twice with two different models and voting on the answer. Hard to come up with a more convincing argument that this feature is now a commodity that can be effectively implemented against all of the leading models.</p>
<p>I've been tinkering with a version of this myself for my Datasette project, with the goal of letting users use prompts to build and iterate on custom widgets and data visualizations against their own data. I also figured out a similar pattern for <a href="https://simonwillison.net/2024/Dec/19/one-shot-python-tools/">writing one-shot Python programs, enabled by uv</a>.</p>
<p>This prompt-driven custom interface feature is so powerful and easy to build (once you've figured out the gnarly details of browser sandboxing) that I expect it to show up as a feature in a wide range of products in 2025.</p>
<h4 id="universal-access-to-the-best-models-lasted-for-just-a-few-short-months">Universal access to the best models lasted for just a few short months</h4>
<p>For a few short months this year all three of the best available models - GPT-4o, Claude 3.5 Sonnet and Gemini 1.5 Pro - were freely available to most of the world.</p>
<p>OpenAI made GPT-4o free for all users <a href="https://openai.com/index/hello-gpt-4o/">in May</a>, and Claude 3.5 Sonnet was freely available from <a href="https://www.anthropic.com/news/claude-3-5-sonnet">its launch in June</a>. This was a momentus change, because for the previous year free users had mostly been restricted to GPT-3.5 level models, meaning new users got a <em>very</em> inaccurate mental model of what a capable LLM could actually do.</p>
<p>That era appears to have ended, likely permanently, with OpenAI's launch of <a href="https://openai.com/index/introducing-chatgpt-pro/">ChatGPT Pro</a>. This $200/month subscription service is the only way to access their most capable model, o1 Pro.</p>
<p>Since the trick behind the o1 series (and the future models it will undoubtedly inspire) is to expend more compute time to get better results, I don't think those days of free access to the best available models are likely to return.</p>
<h4 id="-agents-still-haven-t-really-happened-yet">"Agents" still haven't really happened yet</h4>
<p>I find the term "agents" extremely frustrating. It lacks a single, clear and widely understood meaning... but the people who use the term never seem to acknowledge that.</p>
<p>If you tell me that you are building "agents", you've conveyed almost no information to me at all. Without reading your mind I have no way of telling which of the dozens of possible definitions you are talking about.</p>
<p>The two main categories I see are people who think AI agents are obviously things that go and act on your behalf - the travel agent model - and people who think in terms of LLMs that have been given access to tools which they can run in a loop as part of solving a problem. The term "autonomy" is often thrown into the mix too, again without including a clear definition.</p>
<p>(I also <a href="https://til.simonwillison.net/twitter/collecting-replies">collected 211 definitions</a> on Twitter a few months ago - here they are <a href="https://lite.datasette.io/?json=https://gist.github.com/simonw/bdc7b894eedcfd54f0a2422ea8feaa80#/data/raw">in Datasette Lite</a> - and had <code>gemini-exp-1206</code> <a href="https://gist.github.com/simonw/beaa5f90133b30724c5cc1c4008d0654">attempt to summarize them</a>.)</p>
<p>Whatever the term may mean, agents still have that feeling of perpetually "coming soon".</p>
<p>Terminology aside, I remain skeptical as to their utility based, once again, on the challenge of <strong>gullibility</strong>. LLMs believe anything you tell them. Any systems that attempts to make meaningful decisions on your behalf will run into the same roadblock: how good is a travel agent, or a digital assistant, or even a research tool if it can't distinguish truth from fiction?</p>
<p>Just the other day Google Search was caught <a href="https://simonwillison.net/2024/Dec/29/encanto-2/">serving up an entirely fake description</a> of the non-existant movie "Encanto 2". It turned out to be summarizing an imagined movie listing from <a href="https://ideas.fandom.com/wiki/Encanto_2:_A_New_Generation">a fan fiction wiki</a>.</p>
<p><a href="https://simonwillison.net/series/prompt-injection/">Prompt injection</a> is a natural consequence of this gulibility. I've seen precious little progress on tackling that problem in 2024, and we've been talking about it <a href="https://simonwillison.net/2022/Sep/12/prompt-injection/">since September 2022</a>.</p>
<p>I'm beginning to see the most popular idea of "agents" as dependent on AGI itself. A model that's robust against gulliblity is a very tall order indeed.</p>
<h4 id="evals-really-matter">Evals really matter</h4>
<p>Anthropic's <a href="https://twitter.com/amandaaskell/status/1866207266761760812">Amanda Askell</a> (responsible for much of <a href="https://simonwillison.net/2024/Jun/8/claudes-character/">the work behind Claude's Character</a>):</p>
<blockquote>
<p>The boring yet crucial secret behind good system prompts is test-driven development. You don't write down a system prompt and find ways to test it. You write down tests and find a system prompt that passes them.</p>
</blockquote>
<p>It's become abundantly clear over the course of 2024 that writing good automated evals for LLM-powered systems is <strong>the skill</strong> that's most needed to build useful applications on top of these models. If you have a strong eval suite you can adopt new models faster, iterate better and build more reliable and useful product features than your competition.</p>
<p>Vercel's <a href="https://twitter.com/cramforce/status/1860436022347075667">Malte Ubl</a>:</p>
<blockquote>
<p>When <a href="https://twitter.com/v0">@v0</a> first came out we were paranoid about protecting the prompt with all kinds of pre and post processing complexity.</p>
<p>We completely pivoted to let it rip. A prompt without the evals, models, and especially UX is like getting a broken ASML machine without a manual</p>
</blockquote>
<p>I'm <em>still</em> trying to figure out the best patterns for doing this for my own work. Everyone knows that evals are important, but there remains a lack of great guidance for how to best implement them - I'm tracking this under my <a href="https://simonwillison.net/tags/evals/">evals tag</a>. My <a href="https://simonwillison.net/tags/pelican-riding-a-bicycle/">SVG pelican riding a bicycle benchmark</a> is a pale imitation of what a real eval suite should look like.</p>
<h4 id="apple-intelligence-is-bad-apple-s-mlx-library-is-excellent">Apple Intelligence is bad, Apple's MLX library is excellent</h4>
<p>As a Mac user I've been feeling a lot better about my choice of platform this year.</p>
<p>Last year it felt like my lack of a Linux/Windows  machine with an NVIDIA GPU was a huge disadvantage in terms of trying out new models.</p>
<p>On paper, a 64GB Mac should be a great machine for running models due to the way the CPU and GPU can share the same memory. In practice, many models are released as model weights and libraries that reward NVIDIA's CUDA over other platforms.</p>
<p>The <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a> ecosystem helped a lot here, but the real breakthrough has been Apple's <a href="https://github.com/ml-explore/mlx">MLX</a> library, "an array framework for Apple Silicon". It's fantastic.</p>
<p>Apple's <a href="https://github.com/ml-explore/mlx-examples/tree/main/llms">mlx-lm</a> Python library supports running a wide range of MLX-compatible models on my Mac, with excellent performance. <a href="https://huggingface.co/mlx-community">mlx-community</a> on Hugging Face offers more than 1,000 models that have been converted to the necessary format.</p>
<p>Prince Canuma's excellent, fast moving <a href="https://github.com/Blaizzy/mlx-vlm">mlx-vlm</a> project brings vision LLMs to Apple Silicon as well. I used that recently <a href="https://simonwillison.net/2024/Dec/24/qvq/#with-mlx-vlm">to run Qwen's QvQ</a>.</p>
<p>While MLX is a game changer, Apple's own "Apple Intelligence" features have mostly been a disappointment. I <a href="https://simonwillison.net/2024/Jun/10/apple-intelligence/">wrote about their initial announcement in June</a>, and I was optimistic that Apple had focused hard on the subset of LLM applications that preserve user privacy and minimize the chance of users getting mislead by confusing features.</p>
<p>Now that those features are rolling out they're pretty weak. As an LLM power-user I know what these models are capable of, and Apple's LLM features offer a pale imitation of what a frontier LLM can do. Instead we're getting notification summaries that <a href="https://simonwillison.net/2024/Dec/14/bbc-complains-to-apple-over-misleading-shooting-headline/">misrepresent news headlines</a> and writing assistant tools that I've not found useful at all. Genmoji are <a href="https://bsky.app/profile/simonwillison.net/post/3leceujwvcc2x">kind of fun though</a>.</p>
<h4 id="the-rise-of-inference-scaling-reasoning-models">The rise of inference-scaling "reasoning" models</h4>
<p>The most interesting development in the final quarter of 2024 was the introduction of a new shape of LLM, exemplified by OpenAI's o1 models - initially released as o1-preview and o1-mini <a href="https://simonwillison.net/2024/Sep/12/openai-o1/">on September 12th</a>.</p>
<p>One way to think about these models is an extension of the chain-of-thought prompting trick, first explored in the May 2022 paper <a href="https://arxiv.org/abs/2205.11916">Large Language Models are Zero-Shot Reasoners</a>.</p>
<p>This is that trick where, if you get a model to talk out loud about a problem it's solving, you often get a result which the model would not have achieved otherwise.</p>
<p>o1 takes this process and further bakes it into the model itself. The details are somewhat obfuscated: o1 models spend "reasoning tokens" thinking through the problem that are not directly visible to the user (though the ChatGPT UI shows a summary of them), then outputs a final result.</p>
<p>The biggest innovation here is that it opens up a new way to scale a model: instead of improving model performance purely through additional compute at training time, models can now take on harder problems by spending more compute on inference.</p>
<p>The sequel to o1, o3 (they skipped "o2" for European trademark reasons) was announced <a href="https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/">on 20th December</a> with an impressive result against the <a href="https://simonwillison.net/2024/Dec/20/openai-o3-breakthrough/">ARC-AGI benchmark</a>, albeit one that likely involved more than $1,000,000 of compute time expense!</p>
<p>o3 is expected to ship in January. I doubt many people have real-world problems that would benefit from that level of compute expenditure - I certainly don't! - but it appears to be a genuine next step in LLM architecture for taking on much harder problems.</p>
<p>OpenAI are not the only game in town here. Google released their first entrant in the category, <code>gemini-2.0-flash-thinking-exp</code>, <a href="https://simonwillison.net/2024/Dec/19/gemini-thinking-mode/">on December 19th</a>.</p>
<p>Alibaba's Qwen team <a href="https://qwenlm.github.io/blog/qwq-32b-preview/">released their QwQ model</a> on November 28th - under an Apache 2.0 license, and that one <a href="https://simonwillison.net/2024/Nov/27/qwq/">I could run on my own machine</a>. They followed that up with a vision reasoning model called QvQ <a href="https://qwenlm.github.io/blog/qvq-72b-preview/">on December 24th</a>, which <a href="https://simonwillison.net/2024/Dec/24/qvq/">I also ran locally</a>.</p>
<p>DeepSeek made their <a href="https://api-docs.deepseek.com/news/news1120">DeepSeek-R1-Lite-Preview</a> model available to try out through their chat interface <a href="https://x.com/deepseek_ai/status/1859200141355536422">on November 20th</a>.</p>
<p>To understand more about inference scaling I recommend <a href="https://www.aisnakeoil.com/p/is-ai-progress-slowing-down">Is AI progress slowing down?</a> by Arvind Narayanan and Sayash Kapoor.</p>
<p>Nothing yet from Anthropic or Meta but I would be very surprised if they don't have their own inference-scaling models in the works. Meta published a relevant paper <a href="https://arxiv.org/abs/2412.06769">Training Large Language Models to Reason in a Continuous Latent Space</a> in December.</p>
<h4 id="was-the-best-currently-available-llm-trained-in-china-for-less-than-6m-">Was the best currently available LLM trained in China for less than $6m?</h4>
<p>Not quite, but almost! It does make for a great attention-grabbing headline.</p>
<p>The big news to end the year was the release <a href="https://simonwillison.net/2024/Dec/25/deepseek-v3/">of DeepSeek v3</a> - dropped on Hugging Face on Christmas Day without so much as a README file, then followed by documentation and a paper <a href="https://simonwillison.net/2024/Dec/26/deepseek-v3/">the day after that</a>.</p>
<p>DeepSeek v3 is a huge 685B parameter model - one of the largest openly licensed models currently available, significantly bigger than the largest of Meta's Llama series, Llama 3.1 405B.</p>
<p>Benchmarks put it up there with Claude 3.5 Sonnet. Vibe benchmarks (aka the <a href="https://lmarena.ai/?leaderboard">Chatbot Arena</a>) currently rank it 7th, just behind the Gemini 2.0 and OpenAI 4o/o1 models. This is by far the highest ranking openly licensed model.</p>
<p>The really impressive thing about DeepSeek v3 is the training cost. The model was trained on 2,788,000 H800 GPU hours at an estimated cost of $5,576,000. Llama 3.1 405B trained 30,840,000 GPU hours - 11x that used by DeepSeek v3, for a model that benchmarks slightly worse.</p>
<p>Those <a href="https://www.cnbc.com/2023/10/17/us-bans-export-of-more-ai-chips-including-nvidia-h800-to-china.html">US export regulations</a> on GPUs to China seem to have inspired some <em>very</em> effective training optimizations!</p>
<h4 id="the-environmental-impact-got-better">The environmental impact got better</h4>
<p>A welcome result of the increased efficiency of the models - both the hosted ones and the ones I can run locally - is that the energy usage and environmental impact of running a prompt has dropped enormously over the past couple of years.</p>
<p>OpenAI themselves are charging 100x less for a prompt compared to the GPT-3 days. I have it on good authority that neither Google Gemini nor Amazon Nova (two of the least expensive model providers) are running prompts at a loss.</p>
<p>I think this means that, as individual users, we don't need to feel any guilt at all for the energy consumed by the vast majority of our prompts. The impact is likely neglible compared to driving a car down the street or maybe even watching a video on YouTube.</p>
<p>Likewise, training. DeepSeek v3 training for less than $6m is a fantastic sign that training costs can and should continue to drop.</p>
<p>For less efficient models I find it useful to compare their energy usage to commercial flights. The largest Llama 3 model cost about the same as a single digit number of fully loaded passenger flights from New York to London. That's certainly not nothing, but once trained that model can be used by millions of people at no extra training cost.</p>
<h4 id="the-environmental-impact-got-much-much-worse">The environmental impact got much, much worse</h4>
<p>The much bigger problem here is the enormous competitive buildout of the infrastructure that is imagined to be necessary for these models in the future.</p>
<p>Companies like Google, Meta, Microsoft and Amazon are all spending billions of dollars rolling out new datacenters, with a very material impact <a href="https://www.bloomberg.com/graphics/2024-ai-power-home-appliances/">on the electricity grid</a> and the environment. There's even talk of <a href="https://www.nytimes.com/2024/10/16/business/energy-environment/amazon-google-microsoft-nuclear-energy.html">spinning up new nuclear power stations</a>, but those can take decades.</p>
<p>Is this infrastructure necessary? DeepSeek v3's $6m training cost and the continued crash in LLM prices might hint that it's not. But would you want to be the big tech executive that argued NOT to build out this infrastructure only to be proven wrong in a few years' time?</p>
<p>An interesting point of comparison here could be the way railways rolled out around the world in the 1800s. Constructing these required enormous investments and had a massive environmental impact, and many of the lines that were built turned out to be unnecessary - sometimes multiple lines from different companies serving the exact same routes!</p>
<p>The resulting bubbles contributed to several financial crashes, see Wikipedia for <a href="https://en.wikipedia.org/wiki/Panic_of_1873">Panic of 1873</a>, <a href="https://en.wikipedia.org/wiki/Panic_of_1893">Panic of 1893</a>, <a href="https://en.wikipedia.org/wiki/Panic_of_1901">Panic of 1901</a> and the UK's <a href="https://en.wikipedia.org/wiki/Railway_Mania">Railway Mania</a>. They left us with a lot of useful infrastructure and a great deal of bankruptcies and environmental damage.</p>
<h4 id="the-year-of-slop">The year of slop</h4>
<p>2024 was the year that the word "<a href="https://simonwillison.net/tags/slop/">slop</a>" became a term of art. I wrote about this <a href="https://simonwillison.net/2024/May/8/slop/">in May</a>, expanding on this tweet by <a href="https://twitter.com/deepfates/status/1787472784106639418">@deepfates</a>:</p>
<blockquote>
<p>Watching in real time as “slop” becomes a term of art. the way that “spam” became the term for unwanted emails, “slop” is going in the dictionary as the term for unwanted AI generated content</p>
</blockquote>
<p>I expanded that definition a tiny bit to this:</p>
<blockquote>
<p><strong>Slop</strong> describes AI-generated content that is both <em>unrequested</em> and <em>unreviewed</em>.</p>
</blockquote>
<p>I ended up getting quoted talking about slop in both <a href="https://www.theguardian.com/technology/article/2024/may/19/spam-junk-slop-the-latest-wave-of-ai-behind-the-zombie-internet">the Guardian</a> and <a href="https://www.nytimes.com/2024/06/11/style/ai-search-slop.html">the NY Times</a>. Here's what I said in the NY TImes:</p>
<blockquote>
<p>Society needs concise ways to talk about modern A.I. — both the positives and the negatives. ‘Ignore that email, it’s spam,’ and ‘Ignore that article, it’s slop,’ are both useful lessons.</p>
</blockquote>
<p>I love the term "slop" because it so succinctly captures one of the ways we should <strong>not</strong> be using generative AI!</p>
<p>Slop was even in the running for <a href="https://corp.oup.com/news/voting-opens-for-oxford-word-of-the-year-2024/">Oxford Word of the Year 2024</a>, but it lost <a href="https://corp.oup.com/news/brain-rot-named-oxford-word-of-the-year-2024/">to brain rot</a>.</p>
<h4 id="synthetic-training-data-works-great">Synthetic training data works great</h4>
<p>An idea that surprisingly seems to have stuck in the public consciousness is that of "model collapse". This was first described in the paper <a href="https://arxiv.org/abs/2305.17493">The Curse of Recursion: Training on Generated Data Makes Models Forget</a> in May 2023, and repeated in Nature in July 2024 with the more eye-catching headline <a href="https://www.nature.com/articles/s41586-024-07566-y">AI models collapse when trained on recursively generated data</a>.</p>
<p>The idea is seductive: as the internet floods with AI-generated slop the models themselves will degenerate, feeding on their own output in a way that leads to their inevitable demise!</p>
<p>That's clearly not happening. Instead, we are seeing AI labs increasingly train on <em>synthetic content</em> - deliberately creating artificial data to help steer their models in the right way.</p>
<p>One of the best descriptions I've seen of this comes from <a href="https://simonwillison.net/2024/Dec/15/phi-4-technical-report/">the Phi-4 technical report</a>, which included this:</p>
<blockquote>
<p>Synthetic data as a substantial component of pretraining is becoming increasingly common, and the Phi series of models has consistently emphasized the importance of synthetic data. Rather than serving as a cheap substitute for organic data, synthetic data has several direct advantages over organic data.</p>
<p><strong>Structured and Gradual Learning</strong>. In organic datasets, the relationship between tokens is often complex and indirect. Many reasoning steps may be required to connect the current token to the next, making it challenging for the model to learn effectively from next-token prediction. By contrast, each token generated by a language model is by definition predicted by the preceding tokens, making it easier for a model to follow the resulting reasoning patterns.</p>
</blockquote>
<p>Another common technique is to use larger models to help create training data for their smaller, cheaper alternatives - a trick used by an increasing number of labs. DeepSeek v3 used "reasoning" data created by DeepSeek-R1. Meta's Llama 3.3 70B fine-tuning used <a href="https://github.com/meta-llama/llama-models/blob/main/models/llama3_3/MODEL_CARD.md#training-data">over 25M synthetically generated examples</a>.</p>
<p>Careful design of the training data that goes into an LLM appears to be the <em>entire game</em> for creating these models. The days of just grabbing a full scrape of the web and indiscriminately dumping it into a training run are long gone.</p>
<h4 id="llms-somehow-got-even-harder-to-use">LLMs somehow got even harder to use</h4>
<p>A drum I've been banging for a while is that LLMs are power-user tools - they're chainsaws disguised as kitchen knives. They look deceptively simple to use - how hard can it be to type messages to a chatbot? - but in reality you need a huge depth of both understanding and experience to make the most of them and avoid their many pitfalls.</p>
<p>If anything, this problem got worse in 2024.</p>
<p>We've built computer systems you can talk to in human language, that will answer your questions and <em>usually</em> get them right! ... depending on the question, and how you ask it, and whether it's accurately reflected in the undocumented and secret training set.</p>
<p>The number of available systems has exploded. Different systems have different tools they can apply to your problems - like Python and JavaScript and web search and image generation and maybe even database lookups... so you'd better understand what those tools are, what they can do and how to tell if the LLM used them or not.</p>
<p>Did you know ChatGPT has <a href="https://simonwillison.net/2024/Dec/10/chatgpt-canvas/#what-this-all-means">two entirely different ways</a> of running Python now?</p>
<p>Want to build a Claude Artifact that talks to an external API? You'd better understand CSP and CORS HTTP headers first.</p>
<p>The models may have got more capable, but most of the limitations remained the same. OpenAI's o1 may finally be able to (mostly) count the Rs in strawberry, but its abilities are still limited by its nature as an LLM and the constraints placed on it by the harness it's running in. o1 can't run web searches or use Code Interpreter, but GPT-4o can - both in that same ChatGPT UI. (o1 <a href="https://chatgpt.com/share/677420e4-8854-8006-8940-9bc30b708821">will pretend to do those things</a> if you ask it to, a regression to the <a href="https://simonwillison.net/2023/Mar/10/chatgpt-internet-access/">URL hallucinations bug from early 2023</a>).</p>
<p>What are we doing about this? Not much. Most users are thrown in at the deep end. The default LLM chat UI is like taking brand new computer users, dropping them into a Linux terminal and expecting them to figure it all out.</p>
<p>Meanwhile, it's increasingly common for end users to develop wildly inaccurate mental models of how these things work and what they are capable of. I've seen so many examples of people trying to win an argument with a screenshot from ChatGPT - an inherently ludicrous proposition, given the inherent unreliability of these models crossed with the fact that you can get them to say anything if you prompt them right.</p>
<p>There's a flipside to this too: a lot of better informed people have sworn off LLMs entirely because they can't see how anyone could benefit from a tool with so many flaws. The key skill in getting the most out of LLMs is learning to work with tech that is both inherently unreliable and incredibly powerful at the same time. This is a decidedly non-obvious skill to acquire!</p>
<p>There is <em>so much space</em> for helpful education content here, but we need to do do a lot better than outsourcing it all to AI grifters with bombastic Twitter threads.</p>
<h4 id="knowledge-is-incredibly-unevenly-distributed">Knowledge is incredibly unevenly distributed</h4>
<p>Most people have heard of ChatGPT by now. How many have heard of Claude?</p>
<p>The knowledge gap between the people who actively follow this stuff and the 99% of the population who do not is <em>vast</em>.</p>
<p>The pace of change doesn't help either. In just the past month we've seen general availability of live interfaces where you can <em>point your phone's camera</em> at something and <em>talk about it with your voice</em>... and optionally have it <a href="https://web.archive.org/web/20241230103630/https://help.openai.com/en/articles/10139238-santa-s-voice-in-chatgpt">pretend to be Santa</a>. Most self-certified nerds haven't even tried that yet.</p>
<p>Given the ongoing (and potential) impact on society that this technology has, I don't think the size of this gap is healthy. I'd like to see a lot more effort put into improving this.</p>
<h4 id="llms-need-better-criticism">LLMs need better criticism</h4>
<p>A lot of people <em>absolutely hate</em> this stuff. In some of the spaces I hang out (<a href="https://fedi.simonwillison.net/@simon">Mastodon</a>, <a href="https://bsky.app/profile/simonwillison.net">Bluesky</a>, <a href="https://lobste.rs/">Lobste.rs</a>, even <a href="https://news.ycombinator.com/">Hacker News</a> on occasion) even suggesting that "LLMs are useful" can be enough to kick off a huge fight.</p>
<p>I get it. There are plenty of reasons to dislike this technology - the environmental impact, the (lack of) ethics of the training data, the lack of reliability, the negative applications, the potential impact on people's jobs.</p>
<p>LLMs absolutely warrant criticism. We need to be talking through these problems, finding ways to mitigate them and helping people learn how to use these tools responsibly in ways where the positive applications outweigh the negative.</p>
<p>I <em>like</em> people who are skeptical of this stuff. The hype has been deafening for more than two years now, and there are enormous quantities of snake oil and misinformation out there. A lot of <em>very bad</em> decisions are being made based on that hype. Being critical is a virtue.</p>
<p>If we want people with decision-making authority to make <em>good decisions</em> about how to apply these tools we first need to acknowledge that there ARE good applications, and then help explain how to put those into practice while avoiding the many unintiutive traps.</p>
<p>(If you still don't think there are any good applications at all I'm not sure why you made it to this point in the article!)</p>
<p>I think telling people that this whole field is environmentally catastrophic plagiarism machines that constantly make things up is doing those people a disservice, no matter how much truth that represents. There is genuine value to be had here, but getting to that value is unintuitive and needs guidance.</p>
<p>Those of us who understand this stuff have a duty to help everyone else figure it out.</p>
<h4 id="everything-tagged-llms-on-my-blog-in-2024">Everything tagged "llms" on my blog in 2024</h4>
<p>Because I undoubtedly missed a whole bunch of things, here's every long-form post I wrote in 2024 that I tagged with <a href="https://simonwillison.net/tags/llms/">llms</a>:</p>
<ul>
<li>January
<ul>
<li>7th: <a href="https://simonwillison.net/2024/Jan/7/call-it-ai/">It's OK to call it Artificial Intelligence</a>
</li>
<li>9th: <a href="https://simonwillison.net/2024/Jan/9/what-i-should-have-said-about-ai/">What I should have said about the term Artificial Intelligence</a>
</li>
<li>17th: <a href="https://simonwillison.net/2024/Jan/17/oxide-and-friends/">Talking about Open Source LLMs on Oxide and Friends</a>
</li>
<li>26th: <a href="https://simonwillison.net/2024/Jan/26/llm/">LLM 0.13: The annotated release notes</a>
</li>
</ul>
</li>
<li>February
<ul>
<li>21st: <a href="https://simonwillison.net/2024/Feb/21/gemini-pro-video/">The killer app of Gemini Pro 1.5 is video</a>
</li>
</ul>
</li>
<li>March
<ul>
<li>5th: <a href="https://simonwillison.net/2024/Mar/5/prompt-injection-jailbreaking/">Prompt injection and jailbreaking are not the same thing</a>
</li>
<li>8th: <a href="https://simonwillison.net/2024/Mar/8/gpt-4-barrier/">The GPT-4 barrier has finally been broken</a>
</li>
<li>22nd: <a href="https://simonwillison.net/2024/Mar/22/claude-and-chatgpt-case-study/">Claude and ChatGPT for ad-hoc sidequests</a>
</li>
<li>23rd: <a href="https://simonwillison.net/2024/Mar/23/building-c-extensions-for-sqlite-with-chatgpt-code-interpreter/">Building and testing C extensions for SQLite with ChatGPT Code Interpreter</a>
</li>
<li>26th: <a href="https://simonwillison.net/2024/Mar/26/llm-cmd/">llm cmd undo last git commit - a new plugin for LLM</a>
</li>
</ul>
</li>
<li>April
<ul>
<li>8th: <a href="https://simonwillison.net/2024/Apr/8/files-to-prompt/">Building files-to-prompt entirely using Claude 3 Opus</a>
</li>
<li>10th: <a href="https://simonwillison.net/2024/Apr/10/weeknotes-llm-releases/">Three major LLM releases in 24 hours (plus weeknotes)</a>
</li>
<li>17th: <a href="https://simonwillison.net/2024/Apr/17/ai-for-data-journalism/">AI for Data Journalism: demonstrating what we can do with this stuff right now</a>
</li>
<li>22nd: <a href="https://simonwillison.net/2024/Apr/22/llama-3/">Options for accessing Llama 3 from the terminal using LLM</a>
</li>
</ul>
</li>
<li>May
<ul>
<li>8th: <a href="https://simonwillison.net/2024/May/8/slop/">Slop is the new name for unwanted AI-generated content</a>
</li>
<li>15th: <a href="https://simonwillison.net/2024/May/15/chatgpt-in-4o-mode/">ChatGPT in "4o" mode is not running the new features yet</a>
</li>
<li>29th: <a href="https://simonwillison.net/2024/May/29/training-not-chatting/">Training is not the same as chatting: ChatGPT and other LLMs don't remember everything you say</a>
</li>
</ul>
</li>
<li>June
<ul>
<li>6th: <a href="https://simonwillison.net/2024/Jun/6/accidental-prompt-injection/">Accidental prompt injection against RAG applications</a>
</li>
<li>10th: <a href="https://simonwillison.net/2024/Jun/10/apple-intelligence/">Thoughts on the WWDC 2024 keynote on Apple Intelligence</a>
</li>
<li>17th: <a href="https://simonwillison.net/2024/Jun/17/cli-language-models/">Language models on the command-line</a>
</li>
<li>21st: <a href="https://simonwillison.net/2024/Jun/21/search-based-rag/">Building search-based RAG using Claude, Datasette and Val Town</a>
</li>
<li>27th: <a href="https://simonwillison.net/2024/Jun/27/ai-worlds-fair/">Open challenges for AI engineering</a>
</li>
</ul>
</li>
<li>July
<ul>
<li>14th: <a href="https://simonwillison.net/2024/Jul/14/pycon/">Imitation Intelligence, my keynote for PyCon US 2024</a>
</li>
<li>19th: <a href="https://simonwillison.net/2024/Jul/19/weeknotes/">Weeknotes: GPT-4o mini, LLM 0.15, sqlite-utils 3.37 and building a staging environment</a>
</li>
</ul>
</li>
<li>August
<ul>
<li>6th: <a href="https://simonwillison.net/2024/Aug/6/staging/">Weeknotes: a staging environment, a Datasette alpha and a bunch of new LLMs</a>
</li>
<li>8th: <a href="https://simonwillison.net/2024/Aug/8/django-http-debug/">django-http-debug, a new Django app mostly written by Claude</a>
</li>
<li>23rd: <a href="https://simonwillison.net/2024/Aug/23/anthropic-dangerous-direct-browser-access/">Claude's API now supports CORS requests, enabling client-side applications</a>
</li>
<li>26th: <a href="https://simonwillison.net/2024/Aug/26/gemini-bounding-box-visualization/">Building a tool showing how Gemini Pro can return bounding boxes for objects in images</a>
</li>
</ul>
</li>
<li>September
<ul>
<li>6th: <a href="https://simonwillison.net/2024/Sep/6/weeknotes/">Calling LLMs from client-side JavaScript, converting PDFs to HTML + weeknotes</a>
</li>
<li>10th: <a href="https://simonwillison.net/2024/Sep/10/software-misadventures/">Notes from my appearance on the Software Misadventures Podcast</a>
</li>
<li>12th: <a href="https://simonwillison.net/2024/Sep/12/openai-o1/">Notes on OpenAI's new o1 chain-of-thought models</a>
</li>
<li>20th: <a href="https://simonwillison.net/2024/Sep/20/using-llms-for-code/">Notes on using LLMs for code</a>
</li>
<li>29th: <a href="https://simonwillison.net/2024/Sep/29/notebooklm-audio-overview/">NotebookLM's automatically generated podcasts are surprisingly effective</a>
</li>
<li>30th: <a href="https://simonwillison.net/2024/Sep/30/weeknotes/">Weeknotes: Three podcasts, two trips and a new plugin system</a>
</li>
</ul>
</li>
<li>October
<ul>
<li>1st: <a href="https://simonwillison.net/2024/Oct/1/openai-devday-2024-live-blog/">OpenAI DevDay 2024 live blog</a>
</li>
<li>2nd: <a href="https://simonwillison.net/2024/Oct/2/not-digital-god/">OpenAI DevDay: Let’s build developer tools, not digital God</a>
</li>
<li>15th: <a href="https://simonwillison.net/2024/Oct/15/chatgpt-horoscopes/">ChatGPT will happily write you a thinly disguised horoscope</a>
</li>
<li>17th: <a href="https://simonwillison.net/2024/Oct/17/video-scraping/">Video scraping: extracting JSON data from a 35 second screen capture for less than 1/10th of a cent</a>
</li>
<li>18th: <a href="https://simonwillison.net/2024/Oct/18/openai-audio/">Experimenting with audio input and output for the OpenAI Chat Completion API</a>
</li>
<li>19th: <a href="https://simonwillison.net/2024/Oct/19/mistralrs/">Running Llama 3.2 Vision and Phi-3.5 Vision on a Mac with mistral.rs</a>
</li>
<li>21st: <a href="https://simonwillison.net/2024/Oct/21/claude-artifacts/">Everything I built with Claude Artifacts this week</a>
</li>
<li>22nd: <a href="https://simonwillison.net/2024/Oct/22/computer-use/">Initial explorations of Anthropic's new Computer Use capability</a>
</li>
<li>24th: <a href="https://simonwillison.net/2024/Oct/24/claude-analysis-tool/">Notes on the new Claude analysis JavaScript code execution tool</a>
</li>
<li>27th: <a href="https://simonwillison.net/2024/Oct/27/llm-jq/">Run a prompt to generate and execute jq programs using llm-jq</a>
</li>
<li>29th: <a href="https://simonwillison.net/2024/Oct/29/llm-multi-modal/">You can now run prompts against images, audio and video in your terminal using LLM</a>
</li>
<li>30th: <a href="https://simonwillison.net/2024/Oct/30/monthnotes/">W̶e̶e̶k̶n̶o̶t̶e̶s̶  Monthnotes for October</a>
</li>
</ul>
</li>
<li>November
<ul>
<li>4th: <a href="https://simonwillison.net/2024/Nov/4/haiku/">Claude 3.5 Haiku</a>
</li>
<li>7th: <a href="https://simonwillison.net/2024/Nov/7/project-verdad/">Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5</a>
</li>
<li>12th: <a href="https://simonwillison.net/2024/Nov/12/qwen25-coder/">Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac</a>
</li>
<li>19th: <a href="https://simonwillison.net/2024/Nov/19/notes-from-bing-chat/">Notes from Bing Chat—Our First Encounter With Manipulative AI</a>
</li>
<li>25th: <a href="https://simonwillison.net/2024/Nov/25/ask-questions-of-sqlite/">Ask questions of SQLite databases and CSV/JSON files in your terminal</a>
</li>
</ul>
</li>
<li>December
<ul>
<li>4th: <a href="https://simonwillison.net/2024/Dec/4/amazon-nova/">First impressions of the new Amazon Nova LLMs (via a new llm-bedrock plugin)</a>
</li>
<li>7th: <a href="https://simonwillison.net/2024/Dec/7/prompts-js/">Prompts.js</a>
</li>
<li>9th: <a href="https://simonwillison.net/2024/Dec/9/llama-33-70b/">I can now run a GPT-4 class model on my laptop</a>
</li>
<li>10th: <a href="https://simonwillison.net/2024/Dec/10/chatgpt-canvas/">ChatGPT Canvas can make API requests now, but it's complicated</a>
</li>
<li>11th: <a href="https://simonwillison.net/2024/Dec/11/gemini-2/">Gemini 2.0 Flash: An outstanding multi-modal LLM with a sci-fi streaming mode</a>
</li>
<li>19th: <a href="https://simonwillison.net/2024/Dec/19/one-shot-python-tools/">Building Python tools with a one-shot prompt using uv run and Claude Projects</a>
</li>
<li>19th: <a href="https://simonwillison.net/2024/Dec/19/gemini-thinking-mode/">Gemini 2.0 Flash "Thinking mode"</a>
</li>
<li>20th: <a href="https://simonwillison.net/2024/Dec/20/december-in-llms-has-been-a-lot/">December in LLMs has been a lot</a>
</li>
<li>20th: <a href="https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/">Live blog: the 12th day of OpenAI - "Early evals for OpenAI o3"</a>
</li>
<li>24th: <a href="https://simonwillison.net/2024/Dec/24/qvq/">Trying out QvQ - Qwen's new visual reasoning model</a>
</li>
<li>31st: <a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/">Things we learned about LLMs in 2024</a>
</li>
</ul>
</li>
</ul>
<p>(This list generated <a href="https://simonwillison.net/dashboard/llm-posts-in-2024/">using Django SQL Dashboard</a> with a SQL query <a href="https://gist.github.com/simonw/89c358ac3617b38afc41c79c995a4ebe">written for me by Claude</a>.)</p>


guid: https://simonwillison.net/2025/Jan/2/ending-a-year-long-posting-streak/#atom-entries
title: Ending a year long posting streak
author: Simon Willison
url: https://simonwillison.net/2025/Jan/2/ending-a-year-long-posting-streak/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>A year ago today I wrote about <a href="https://simonwillison.net/2024/Jan/2/escalating-streaks/">Tom Scott's legendary 10 year YouTube streak</a>, in which he posted a new video once a week for the next ten years. Inspired by that, I also started my own.</p>
<p>I set myself the goal of posting something to my blog every day for a year.</p>
<p>Given how much happened in my chosen field of <a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/">Large Language Models over the course of 2024</a> this wasn't as hard as I had expected!</p>
<p>One of the lessons I learned from Tom is that it's much healthier for a streak to have a predetermined end - that way the streak can act as a goal that doesn't turn into an ongoing imposition.</p>
<p>I'm calling it: this streak is done. According to <a href="https://simonwillison.net/dashboard/streaks-with-post-count/">my custom dashboard</a> I hit 367 days - December 31st 2023 to December 31st 2024, inclusive (it was a leap year) - 1,151 posts in total.</p>

<p><img src="https://static.simonwillison.net/static/2025/jan-streak.jpg" style="max-width: 100%" alt="Table of data. Row 1 has duration in days=1, start date=2025-01-02, end date=2025-01-02, num posts=1. Row 2 has duration in days=367, start date=2023-12-31, end date=2024-12-31, num posts=1151. Row 3 has duration in days=1, start date=2023-12-23, end date=2023-12-23, num posts=1. Row 4 has duration in days=4, start date=2023-12-18, end date=2023-12-21, num posts=6." /></p>

<p>I'm going to drop back to a much more reasonable target of at least one long-form post per week and at least three days per week with a link or quote - see <a href="https://simonwillison.net/2024/Dec/22/link-blog/">My approach to running a link blog</a> for how I think about that kind of content.</p>
<p>Posting daily has been fun, but it definitely impacted my productivity on my other projects. My blog runs on UTC so it also resulted in a minor panic coming up to 4pm Pacific coast time if I hadn't posted anything yet!</p>

<p>Almost every post in the streak came out in 2024, so my <a href="https://simonwillison.net/search/?year=2024">faceted search engine for 2024</a> provides a way to explore them.</p>

<p>My <a href="https://simonwillison.net/2024/">2024 archive page</a> also serves up this illustrative tag cloud:</p>

<p><img src="https://static.simonwillison.net/static/2025/2024-tag-cloud.jpg" style="max-width: 100%" alt="A tag cloud with llms and ai as the central largest terms, surrounded by technology-related words: nomic, datasette, security, rag, projects, llama, openai, gemini, edge-llms, psf, sql, open-source, json, javascript, ethics, python, google, plugins, gis, django, apple, sqlite, aws, tools, rust, golang, c, uv, s3, css, git, ocr" /></p>


guid: https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/#atom-entries
title: I still don't think companies serve you ads based on spying through your microphone
author: Simon Willison
url: https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>One of my weirder hobbies is trying to convince people that the idea that companies are listening to you through your phone's microphone and serving you targeted ads is a conspiracy theory that isn't true. I wrote about this previously: <a href="https://simonwillison.net/2023/Dec/14/ai-trust-crisis/#facebook-dont-spy-microphone">Facebook don’t spy on you through your microphone</a>.</p>
<p>(Convincing people of this is basically impossible. It doesn't matter how good your argument is, if someone has ever seen an ad that relates to their previous voice conversation they are likely convinced and there's nothing you can do to talk them out of it. Gimlet media did <a href="https://gimletmedia.com/amp/shows/reply-all/z3hlwr">a great podcast episode</a> about how impossible this is back in 2017.)</p>
<p>This is about to get even harder thanks to this proposed settlement: <a href="https://arstechnica.com/tech-policy/2025/01/apple-agrees-to-pay-95m-delete-private-conversations-siri-recorded/">Siri “unintentionally” recorded private convos; Apple agrees to pay $95M</a> (Ars Technica).</p>
<p>Apple are spending $95m (nine hours of profit), agreeing to settle while "denying wrongdoing".</p>
<p>What actually happened is it turns out Apple were capturing snippets of audio surrounding the "Hey Siri" wake word, sending those back to their servers and occasionally using them for QA, without informing users that they were doing this. This is bad.</p>
<p>The Reuters 2021 story <a href="https://www.reuters.com/technology/apple-must-face-siri-voice-assistant-privacy-lawsuit-us-judge-2021-09-02/">Apple must face Siri voice assistant privacy lawsuit -U.S. judge</a> reported that:</p>
<blockquote>
<p>One Siri user said his private discussions with his doctor about a "brand name surgical treatment" caused him to receive targeted ads for that treatment, while two others said their discussions about Air Jordan sneakers, Pit Viper sunglasses and "Olive Garden" caused them to receive ads for those products.</p>
</blockquote>
<p>The claim from that story was then repeated in <a href="https://www.reuters.com/legal/apple-pay-95-million-settle-siri-privacy-lawsuit-2025-01-02/">the 2025 Reuters story</a> about the settlement.</p>
<p>The <a href="https://arstechnica.com/tech-policy/2025/01/apple-agrees-to-pay-95m-delete-private-conversations-siri-recorded/">Ars Technica story</a> reframes that like this:</p>
<blockquote>
<p>The only clue that users seemingly had of Siri's alleged spying was eerily accurate targeted ads that appeared after they had just been talking about specific items like Air Jordans or brands like Olive Garden, Reuters <a href="https://www.reuters.com/legal/apple-pay-95-million-settle-siri-privacy-lawsuit-2025-01-02/">noted</a>.</p>
</blockquote>
<p>Crucially, this was never <em>proven in court</em>. And if Apple settle the case it never will be.</p>
<p>Let’s think this through. For the accusation to be true, Apple would need to be recording those wake word audio snippets and transmitting them back to their servers for additional processing (likely true), but then they would need to be feeding those snippets <em>in almost real time</em> into a system which forwards them onto advertising partners who then feed that information into targeting networks such that next time you view an ad on your phone the information is available to help select the relevant ad.</p>
<p>That is <em>so far fetched</em>. Why would Apple do that? Especially given both their brand and reputation as a privacy-first company combined with the large amounts of product design and engineering work they’ve put into preventing apps from doing exactly this kind of thing by enforcing permission-based capabilities <em>and</em> ensuring a “microphone active” icon is available at all times when an app is listening in.</p>
<p>I really don't think this is happening - in particular for Siri wake words!</p>

<p id="argued-these-points">I've <a href="https://simonwillison.net/2023/Dec/14/ai-trust-crisis/#facebook-dont-spy-microphone">argued these points before</a>, but I'll do it again here for good measure.</p>
<ol>
<li>You don't notice the hundreds of times a day you say something and <em>don't</em> see a relevant advert a short time later. You see thousands of ads a day, can you remember what <em>any</em> of them are?</li>
<li>The tiny fraction of times where you see an ad that's relevant to something you've just said (hence breaking through your filter that prevents you from seeing most ads at all) stick in your head.</li>
<li>Human beings are pattern matching machines with a huge bias towards personal anecdotes. If we've seen direct evidence of something ourselves, good luck talking us out of it!</li>
</ol>
<p>I think the truth of the matter here is much more pedestrian: the quality of ad targeting that's possible just through apps sharing data on your regular actions within those apps is shockingly high... combined with the fact that it turns out just knowing "male, 40s, NYC" is often more than enough - we're all pretty basic!</p>
<p>I fully expect that this Apple story will be used as "proof" by conspiracy theorists effectively forever.</p>


guid: https://simonwillison.net/2025/Jan/4/weeknotes/#atom-entries
title: Weeknotes: Starting 2025 a little slow
author: Simon Willison
url: https://simonwillison.net/2025/Jan/4/weeknotes/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>I published my <a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/">review of 2024 in LLMs</a> and then got into a fight with most of the internet over the <a href="https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/">phone microphone targeted ads conspiracy theory</a>.</p>
<p>In my last weeknotes I talked about how <a href="https://simonwillison.net/2024/Dec/20/december-in-llms-has-been-a-lot/">December in LLMs has been a lot</a>. That was on December 20th, and it turned out there were at least three big new LLM stories still to come before the end of the year:</p>
<ul>
<li>OpenAI announced initial benchmarks for their o3 reasoning model, which I covered <a href="https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/">in a live blog</a> for the last day of their mixed-quality 12 days of OpenAI series. o3 is <a href="https://simonwillison.net/2024/Dec/20/openai-o3-breakthrough/">genuinely impressive</a>.</li>
<li>Alibaba's Qwen released their <a href="https://simonwillison.net/2024/Dec/24/qvq/">QvQ visual reasoning model</a>, which I ran locally <a href="https://simonwillison.net/2024/Dec/24/qvq/#with-mlx-vlm">using mlx-vlm</a>. It's the o1/o3 style trick applied to image prompting and it runs on my laptop.</li>
<li>DeepSeek - the other big open license Chinese AI lab - shocked everyone by <a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#was-the-best-currently-available-llm-trained-in-china-for-less-than-6m-">releasing DeepSeek v3 on Christmas day</a>, an open model that compares favorably to the very best closed model and was trained for just $5.6m, 11x less that Meta's best Llama 3 model, Llama 3.1 405B.</li>
</ul>
<p>For the second year running I published my <a href="https://simonwillison.net/series/llms-annual-review/">review of LLM developments over the past year</a> on December 31st. I'd estimate this took at least four hours of computer time to write and another two of miscellaneous note taking over the past few weeks, but that's likely an under-estimate.</p>
<p>It went over really well. I've had a ton of great feedback about it, both from people who wanted to catch up and from people who have been following the space closely. I even <a href="https://daringfireball.net/linked/2025/01/02/willison-llms-2024">got fireballed</a>!</p>
<p>I've had a slower start to 2025 than I had intended. A challenge with writing online is that, like code, writing requires maintenance: any time I drop a popular article I feel obliged to track and participate in any resulting conversations.</p>
<p>Then just as the chatter about my 2024 review started to fade, the Apple Siri microphone settlement story broke and I couldn't resist publishing <a href="https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/">I still don’t think companies serve you ads based on spying through your microphone</a>.</p>
<p>Trying to talk people out of believing that conspiracy theory is my toxic trait. I know there's no point even trying, but I can't drag myself away.</p>
<p>I think my New Year's resolution should probably be to spend less time arguing with people on the internet!</p>
<p>Anyway: January is here, and I'm determined to use it to make progress on both Datasette 1.0 and the paid launch of Datasette Cloud.</p>
<h4 id="blog-entries">Blog entries</h4>
<ul>
<li><a href="https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/">I still don't think companies serve you ads based on spying through your microphone</a></li>
<li><a href="https://simonwillison.net/2025/Jan/2/ending-a-year-long-posting-streak/">Ending a year long posting streak</a></li>
<li><a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/">Things we learned about LLMs in 2024</a></li>
<li><a href="https://simonwillison.net/2024/Dec/24/qvq/">Trying out QvQ - Qwen's new visual reasoning model</a></li>
<li><a href="https://simonwillison.net/2024/Dec/22/link-blog/">My approach to running a link blog</a></li>
<li><a href="https://simonwillison.net/2024/Dec/20/live-blog-the-12th-day-of-openai/">Live blog: the 12th day of OpenAI - "Early evals for OpenAI o3"</a></li>
</ul>
<h4 id="tils">TILs</h4>
<ul>
<li>
<a href="https://til.simonwillison.net/git/size-of-lfs-files">Calculating the size of all LFS files in a repo</a> - 2024-12-25</li>
<li>
<a href="https://til.simonwillison.net/llms/bert-ner">Named Entity Resolution with dslim/distilbert-NER</a> - 2024-12-24</li>
</ul>


guid: https://simonwillison.net/2025/Jan/10/ai-predictions/#atom-entries
title: My AI/LLM predictions for the next 1, 3 and 6 years, for Oxide and Friends
author: Simon Willison
url: https://simonwillison.net/2025/Jan/10/ai-predictions/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>The <a href="https://oxide-and-friends.transistor.fm/">Oxide and Friends</a> podcast has an annual tradition of asking guests to share their predictions for the next 1, 3 and 6 years. Here's <a href="https://github.com/oxidecomputer/oxide-and-friends/blob/master/2022_01_03.md">2022</a>, <a href="https://github.com/oxidecomputer/oxide-and-friends/blob/master/2023_01_09.md">2023</a> and <a href="https://github.com/oxidecomputer/oxide-and-friends/blob/master/2024_01_08.md">2024</a>. This year they invited me to participate. I've never been brave enough to share <em>any</em> public predictions before, so this was a great opportunity to get outside my comfort zone!</p>
<p>We recorded the episode live using Discord on Monday. It's now available <a href="https://www.youtube.com/watch?v=-pk6VokHpGY">on YouTube</a> and <a href="https://oxide-and-friends.transistor.fm/">in podcast form</a>.</p>

<p><lite-youtube videoid="-pk6VokHpGY"
  title="Oxide and Friends 1/6/2025 -- Predictions 2025"
  playlabel="Play: Oxide and Friends 1/6/2025 -- Predictions 2025"
> </lite-youtube></p>

<p>Here are my predictions, written up here in a little more detail than the stream of consciousness I shared on the podcast.</p>
<p>I should emphasize that I find the very idea of trying to predict AI/LLMs over a multi-year period to be completely absurd! I can't predict what's going to happen a week from now, six years is a different universe.</p>
<p>With that disclaimer out of the way, here's an expanded version of what I said.</p>
<ul>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#one-year-agents-fail-to-happen-again">One year: Agents fail to happen, again</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#one-year-code-research-assistants">One year: ... except for code and research assistants</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#three-years-someone-wins-a-pulitzer-for-ai-assisted-investigative-reporting">Three years: Someone wins a Pulitzer for AI-assisted investigative reporting</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#three-years-part-two-privacy-laws-with-teeth">Three years part two: privacy laws with teeth</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#six-years-utopian-amazing-art">Six years utopian: amazing art</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#six-years-dystopian-agi-asi-causes-mass-civil-unrest">Six years dystopian: AGI/ASI causes mass civil unrest</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#my-total-lack-of-conviction">My total lack of conviction</a></li>
</ul>
<h4 id="one-year-agents-fail-to-happen-again">One year: Agents fail to happen, again</h4>
<p>I wrote about how <a href="https://simonwillison.net/2024/Dec/31/llms-in-2024/#-agents-still-haven-t-really-happened-yet">“Agents” still haven’t really happened yet</a> in my review of Large Language Model developments  in 2024.</p>
<p>I think we are going to see a <em>lot</em> more froth about agents in 2025, but I expect the results will be a great disappointment to most of the people who are excited about this term. I expect a lot of money will be lost chasing after several different poorly defined dreams that share that name.</p>
<p>What are agents anyway? Ask a dozen people and you'll get a dozen slightly different answers - I collected and <a href="https://gist.github.com/simonw/beaa5f90133b30724c5cc1c4008d0654">then AI-summarized a bunch of those here</a>.</p>
<p>For the sake of argument, let's pick a definition that I can predict won't come to fruition: the idea of an AI assistant that can go out into the world and semi-autonomously act on your behalf. I think of this as the <strong>travel agent</strong> definition of agents, because for some reason everyone always jumps straight to flight and hotel booking and itinerary planning when they describe this particular dream.</p>
<p>Having the current generation of LLMs make material decisions on your behalf - like what to spend money on - is a <em>really bad idea</em>. They're too unreliable, but more importantly they are too <strong>gullible</strong>.</p>
<p>If you're going to arm your AI assistant with a credit card and set it loose on the world, you need to be confident that it's not going to hit "buy" on the first website that claims to offer the best bargains!</p>
<p>I'm confident that reliability is the reason we haven't seen LLM-powered agents that have taken off yet, despite the idea attracting a huge amount of buzz since right after ChatGPT first came out.</p>
<p>I would be very surprised if any of the models released over the next twelve months had enough of a reliability improvement to make this work. Solving gullibility is an astonishingly difficult problem.</p>
<p>(I had <a href="https://www.youtube.com/watch?v=-pk6VokHpGY&amp;t=1206s">a particularly spicy rant</a> about how stupid the idea of sending a "digital twin" to a meeting on your behalf is.)</p>
<h4 id="one-year-code-research-assistants">One year: ... except for code and research assistants</h4>
<p>There are two categories of "agent" that I do believe in, because they're proven to work already.</p>
<p>The first is <strong>coding assistants</strong> - where an LLM writes, executes and then refines computer code in a loop.</p>
<p>I first saw this pattern demonstrated by OpenAI with their <a href="https://simonwillison.net/tags/code-interpreter/">Code Interpreter</a> feature for ChatGPT, released back in March/April of 2023.</p>
<p>You can ask ChatGPT to solve a problem that can use Python code and it will write that Python, execute it in a secure sandbox (I think it's Kubernetes) and then use the output - or any error messages - to determine if the goal has been achieved.</p>
<p>It's a beautiful pattern that worked great with early 2023 models (I believe it first shipped using original GPT-4), and continues to work today.</p>
<p>Claude added their own version in October (<a href="https://simonwillison.net/2024/Oct/24/claude-analysis-tool/">Claude analysis</a>, using JavaScript that runs in the browser), Mistral have it, Gemini has a version and there are dozens of other implementations of the same pattern.</p>
<p>The second category of agents that I believe in is <strong>research assistants</strong> - where an LLM can run multiple searches, gather information and aggregate that into an answer to a question or write a report.</p>
<p><a href="https://www.perplexity.ai/">Perplexity</a> and <a href="https://openai.com/index/introducing-chatgpt-search/">ChatGPT Search</a> have both been operating in this space for a while, but by far the most impressive implementation I've seen is Google Gemini's <a href="https://blog.google/products/gemini/google-gemini-deep-research/">Deep Research</a> tool, which I've had access to for a few weeks.</p>
<p>With Deep Research I can pose a question like this one:</p>
<blockquote>
<p>Pillar Point Harbor is one of the largest communal brown pelican roosts on the west coast of North America.</p>
<p>find others</p>
</blockquote>
<p>And Gemini will draft a plan, consult dozens of different websites via Google Search and then assemble a report (with all-important citations) describing what it found.</p>
<p>Here's the plan it came up with:</p>
<blockquote>
<p>Pillar Point Harbor is one of the largest communal brown pelican roosts on the west coast of North America. Find other large communal brown pelican roosts on the west coast of North America.<br />
(1) Find a list of brown pelican roosts on the west coast of North America.<br />
(2) Find research papers or articles about brown pelican roosts and their size.<br />
(3) Find information from birdwatching organizations or government agencies about brown pelican roosts.<br />
(4) Compare the size of the roosts found in (3) to the size of the Pillar Point Harbor roost.<br />
(5) Find any news articles or recent reports about brown pelican roosts and their populations.</p>
</blockquote>
<p>It dug up a whole bunch of details, but the one I cared most about was <a href="https://birdallianceoregon.org/wp-content/uploads/2021/04/Brown-Pelican-survey_4-year_summary-infographic_2016-19_final.pdf">these PDF results for the 2016-2019 Pacific Brown Pelican Survey</a> conducted by the West Coast Audubon network and partners - a PDF that included this delightful list:</p>
<blockquote>
<p>Top 10 Megaroosts (sites that traditionally host &gt;500 pelicans) with average fall count numbers:</p>
<ul>
<li>Alameda Breakwater, CA (3,183)</li>
<li>Pillar Point Harbor, CA (1,481)</li>
<li>East Sand Island, OR (1,121)</li>
<li>Ano Nuevo State Park, CA (1,068)</li>
<li>Salinas River mouth, CA (762)</li>
<li>Bolinas Lagoon, CA (755)</li>
<li>Morro Rock, CA (725)</li>
<li>Moss landing, CA (570)</li>
<li>Crescent City Harbor, CA (514)</li>
<li>Bird Rock Tomales, CA (514)</li>
</ul>
</blockquote>
<p>My local harbor is the second biggest megaroost!</p>
<p>It makes intuitive sense to me that this kind of research assistant can be built on our current generation of LLMs. They're competent at driving tools, they're capable of coming up with a relatively obvious research plan (look for newspaper articles and research papers) and they can synthesize sensible answers given the right collection of context gathered through search.</p>
<p>Google are particularly well suited to solving this problem: they have the world's largest search index and their Gemini model has a 2 million token context. I expect Deep Research to get a whole lot better, and I expect it to attract plenty of competition.</p>
<h4 id="three-years-someone-wins-a-pulitzer-for-ai-assisted-investigative-reporting">Three years: Someone wins a Pulitzer for AI-assisted investigative reporting</h4>
<p>I went for a bit of a self-serving prediction here: I think within three years someone is going to win a Pulitzer prize for a piece of investigative reporting that was aided by generative AI tools.</p>

<p><em><strong>Update</strong>: after publishing this piece I learned about this May 2024 story from Nieman Lab: <a href="https://www.niemanlab.org/2024/05/for-the-first-time-two-pulitzer-winners-disclosed-using-ai-in-their-reporting/">For the first time, two Pulitzer winners disclosed using AI in their reporting</a>. I think these were both examples of traditional machine learning as opposed to LLM-based generative AI, but this is yet another example of my predictions being less ambitious than I had thought!</em></p>

<p>I do <em>not</em> mean that an LLM will write the article! I continue to think that having LLMs write on your behalf is one of the least interesting applications of these tools.</p>
<p>I called this prediction self-serving because I want to help make this happen! My <a href="https://datasette.io">Datasette</a> suite of open source tools for data journalism has been growing AI features, like <a href="https://simonwillison.net/2023/Dec/1/datasette-enrichments/">LLM-powered data enrichments</a> and <a href="https://www.datasette.cloud/blog/2024/datasette-extract/">extracting structured data</a> into tables from unstructured text.</p>
<p>My dream is for those tools - or tools like them - to be used for an award winning piece of investigative reporting.</p>
<p>I picked three years for this because I think that's how long it will take for knowledge of how to responsibly and effectively use these tools to become widespread enough for that to happen.</p>
<p>LLMs are not an obvious fit for journalism: journalists look for the truth, and LLMs are notoriously prone to hallucination and making things up. But journalists are also <em>really good</em> at extracting useful information from potentially untrusted sources - that's a lot of what the craft of journalism is about.</p>
<p>The two areas I think LLMs are particularly relevant to journalism are:</p>
<ul>
<li>Structured data extraction. If you have 10,000 PDFs from a successful Freedom of Information Act request, someone or something needs to kick off the process of reading through them to find the stories. LLMs are a fantastic way to take a vast amount of information and start making some element of sense from it. They can act as lead generators, helping identify the places to start looking more closely.</li>
<li>Coding assistance. Writing code to help analyze data is a huge part of modern data journalism - from SQL queries through data cleanup scripts, custom web scrapers or visualizations to help find signal among the noise. Most newspapers don't have a team of programmers on staff: I think within three years we'll have robust enough tools built around this pattern that non-programmer journalists will be able to use them as part of their reporting process.</li>
</ul>
<p>I hope to build some of these tools myself!</p>
<p>So my concrete prediction for three years is that someone wins a Pulitzer with a small amount of assistance from LLMs.</p>
<p>My more general prediction: within three years it won't be surprising at all to see most information professionals use LLMs as part of their daily workflow, in increasingly sophisticated ways. We'll know exactly what patterns work and how best to explain them to people. These skills will become widespread.</p>
<h4 id="three-years-part-two-privacy-laws-with-teeth">Three years part two: privacy laws with teeth</h4>
<p>My other three year prediction concerned privacy legislation.</p>
<p>The levels of (often justified) paranoia around both targeted advertising and what happens to the data people paste into these models is a constantly growing problem.</p>
<p>I wrote recently about the <a href="https://simonwillison.net/2025/Jan/2/they-spy-on-you-but-not-like-that/">inexterminable conspiracy theory that Apple target ads through spying through your phone's microphone</a>. I've written in the past about <a href="https://simonwillison.net/2023/Dec/14/ai-trust-crisis/">the AI trust crisis</a>, where people refuse to believe that models are not being trained on their inputs no matter how emphatically the companies behind them deny it.</p>
<p>I think the AI industry itself would benefit enormously from legislation that helps clarify what's going on with training on user-submitted data, and the wider tech industry could really do with harder rules around things like data retention and targeted advertising.</p>
<p>I don't expect the next four years of US federal government to be effective at passing legislation, but I expect we'll see privacy legislation with sharper teeth emerging at the state level or internationally. Let's just hope we don't end up with a new generation of cookie-consent banners as a result!</p>
<h4 id="six-years-utopian-amazing-art">Six years utopian: amazing art</h4>
<p>For six years I decided to go with two rival predictions, one optimistic and one pessimistic.</p>
<p>I think six years is long enough that we'll figure out how to harness this stuff to make some <strong>really great art</strong>.</p>
<p>I don't think generative AI for art - images, video and music - deserves nearly the same level of respect as a useful tool as text-based LLMs. Generative art tools are a lot of fun to try out but the lack of fine-grained control over the output greatly limits its utility outside of personal amusement or generating <a href="https://simonwillison.net/tags/slop/">slop</a>.</p>
<p>More importantly, they lack social acceptability. The vibes aren't good. Many talented artists have loudly rejected the idea of these tools, to the point that the very term "AI" is developing a distasteful connotation in society at large.</p>
<p>Image and video models are also ground zero for the AI training data ethics debate, and for good reason: no artist wants to see a model trained on their work without their permission that then directly competes with them!</p>
<p>I think six years is long enough for this whole thing to shake out - for society to figure out acceptable ways of using these tools to truly elevate human expression. What excites me is the idea of truly talented, visionary creative artists using whatever these tools have evolved into in six years to make meaningful art that could never have been achieved without them.</p>
<p>On the podcast I talked about <a href="https://en.wikipedia.org/wiki/Everything_Everywhere_All_at_Once">Everything Everywhere All at Once</a>, a film that deserved every one of its seven Oscars. The core visual effects team on that film was just five people. Imagine what a team like that could do with the generative AI tools we'll have in six years time!</p>
<p id="since-recording">Since recording the podcast I learned from <a href="https://www.swyx.io/">Swyx</a> that Everything Everywhere All at Once <a href="https://www.aboutamazon.com/news/aws/how-ai-tools-are-creating-new-possibilities-for-movies-and-visual-design-according-to-this-aws-powered-startup">used Runway ML as part of their toolset already</a>:</p>
<blockquote>
<p>Evan Halleck was on this team, and he used Runway's AI tools to save time and automate tedious aspects of editing. Specifically in the film’s rock scene, he used Runway’s rotoscoping tool to get a quick, clean cut of the rocks as sand and dust were moving around the shot. This translated days of work to a matter of minutes.</p>
</blockquote>
<p>I said I thought a film that had used generative AI tools would win an Oscar within six years. Looks like I was eight years out on that one!</p>
<h4 id="six-years-dystopian-agi-asi-causes-mass-civil-unrest">Six years dystopian: AGI/ASI causes mass civil unrest</h4>
<p>My pessimistic alternative take for 2031 concerns "AGI" - a term which, like "agents", is constantly being redefined. The Information <a href="https://www.theinformation.com/articles/microsoft-and-openai-wrangle-over-terms-of-their-blockbuster-partnership">recently reported</a> (see also <a href="https://www.theverge.com/2025/1/6/24337106/sam-altman-says-openai-knows-how-to-build-agi-blog-post">The Verge</a>) that Microsoft and OpenAI are now defining AGI as a system capable of generating $100bn in profit!</p>
<p>If we assume AGI is the point at which AI systems are capable of performing almost any job currently reserved for a human being it's hard <em>not</em> to see potentially negative consequences.</p>
<p>Sam Altman may have <a href="https://www.bloomberg.com/news/articles/2024-07-22/ubi-study-backed-by-openai-s-sam-altman-bolsters-support-for-basic-income">experimented with Universal Basic Income</a>, but the USA is a country that can't even figure out universal healthcare! I have huge trouble imagining a future economy that works for the majority of people when the majority of jobs are being done by machines.</p>
<p>So my dystopian prediction for 2031 is that if that form of AGI has come to pass it will be accompanied by extraordinarily bad economic outcomes and mass civil unrest.</p>
<p>My version of an AI utopia is tools that augment existing humans. That's what we've had with LLMs so far, and my ideal is that those tools continue to improve and subsequently humans become able to take on <a href="https://simonwillison.net/2023/Mar/27/ai-enhanced-development/">more ambitious work</a>.</p>
<p>If there's a version of AGI that results in that kind of utopia, I'm all for it.</p>
<h4 id="my-total-lack-of-conviction">My total lack of conviction</h4>
<p>There's a reason I haven't made predictions like this before: my confidence in my ability to predict the future is almost non-existent. At least one of my predictions here <a href="https://simonwillison.net/2025/Jan/10/ai-predictions/#since-recording">already proved to be eight years late</a>!</p>
<p>These predictions are in the public record now (I even <a href="https://github.com/oxidecomputer/oxide-and-friends/pull/158">submitted a pull request</a>).</p>
<p>It's going to be interesting looking back at these in one, three and six years to see how I did.</p>


guid: https://simonwillison.net/2025/Jan/20/deepseek-r1/#atom-entries
title: DeepSeek-R1 and exploring DeepSeek-R1-Distill-Llama-8B
author: Simon Willison
url: https://simonwillison.net/2025/Jan/20/deepseek-r1/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>DeepSeek are the Chinese AI lab who dropped the best currently available open weights LLM <a href="https://simonwillison.net/2024/Dec/26/deepseek-v3/">on Christmas day</a>, DeepSeek v3. That model was trained in part using their unreleased R1 "reasoning" model. Today <a href="https://github.com/deepseek-ai/DeepSeek-R1">they've released R1 itself</a>, along with a whole family of new models derived from that base.</p>
<p>There's a whole lot of stuff in the new release.</p>
<p><strong>DeepSeek-R1-Zero</strong> appears to be the base model. It's <a href="https://huggingface.co/deepseek-ai/DeepSeek-R1-Zero/tree/main">over 650GB</a> in size and, like most of their other releases, is <a href="https://huggingface.co/deepseek-ai/DeepSeek-R1-Zero/blob/main/LICENSE">under a clean MIT license</a>. DeepSeek warn that "DeepSeek-R1-Zero encounters challenges such as endless repetition, poor readability, and language mixing." ... so they also released:</p>
<p><strong>DeepSeek-R1</strong> - which "incorporates cold-start data before RL" and "achieves performance comparable to OpenAI-o1 across math, code, and reasoning tasks". That one is also MIT licensed, and is a similar size.</p>
<p>I don't have the ability to run models larger than about 50GB (I have an M2 with 64GB of RAM), so neither of these two models are something I can easily play with myself. That's where the new <strong>distilled models</strong> come in.</p>
<blockquote>
<p>To support the research community, we have open-sourced DeepSeek-R1-Zero, DeepSeek-R1, and six dense models distilled from DeepSeek-R1 based on Llama and Qwen.</p>
</blockquote>
<p>This is a fascinating flex! They have models based on Qwen 2.5 (14B, 32B, Math 1.5B and Math 7B) and Llama 3 (Llama-3.1 8B and Llama 3.3 70B Instruct).</p>
<p>Weirdly those Llama models have an MIT license attached, which I'm not sure is compatible with the underlying Llama license. Qwen models are Apache licensed so maybe MIT is OK?</p>
<p>(I also <a href="https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-14B/commit/c79f47acaf303faabb7133b4b7b76f24231f2c8d#d2h-740129">just noticed</a> the MIT license files say "Copyright (c) 2023 DeepSeek" so they may need to pay a little bit more attention to how they copied those in.)</p>
<p>Licensing aside, these distilled models are fascinating beasts.</p>
<h4 id="running-deepseek-r1-distill-llama-8b-gguf">Running DeepSeek-R1-Distill-Llama-8B-GGUF</h4>
<p>Quantized versions are already starting to show up. So far I've tried just one of those -  <code>unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF</code> released by <a href="https://unsloth.ai/">Unsloth AI</a> - and it's really fun to play with.</p>
<p>I'm running it using the combination of <a href="https://ollama.com/">Ollama</a>, <a href="https://llm.datasette.io/">LLM</a> and the <a href="https://github.com/taketwo/llm-ollama">llm-ollama plugin</a>.</p>
<p>First I fetched and ran the model using Ollama itself:</p>
<pre><code>ollama run hf.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF:Q8_0
</code></pre>
<p>This downloads around 8.5GB of model data and starts an interactive chat interface.</p>
<p>Once the model has been fetched, LLM can talk to it as well. I prefer using LLM for experiments because it <a href="https://llm.datasette.io/en/stable/logging.html">logs everything to SQLite</a> for later exploration.</p>
<p>I installed the plugin and ran it like this:</p>
<pre><code>llm install llm-ollama
llm -m 'hf.co/unsloth/DeepSeek-R1-Distill-Llama-8B-GGUF:Q8_0' \
  'a joke about a pelican and a walrus who run a tea room together'
</code></pre>
<p>Each response starts with a <code>&lt;think&gt;...&lt;/think&gt;</code> pseudo-XML tag containing the chain of thought used to help generate the response. For "a joke about a pelican and a walrus who run a tea room together" that started like this:</p>
<blockquote>
<p><code>&lt;think&gt;</code><br />
Okay, so I need to come up with a joke about a pelican and a walrus running a tea room together. Hmm, that's an interesting combination. Let me think about how these two characters might interact in a humorous situation.</p>
<p>First, let's consider their characteristics. Pelicans are known for their long beaks and Webbed feet, often seen near the beach or water. Walruses have big teeth, thick fur, and they're generally found in colder climates, like icebergs or snowy areas. So, combining these two into a tea room setting is already a funny image.</p>
<p>[...]</p>
</blockquote>
<p>It then thought for <em>20 paragraphs</em> before outputting the joke! Here's <a href="https://gist.github.com/simonw/f505ce733a435c8fc8fdf3448e3816b0">the full transcript</a> and here's the output at the end, after the <code>&lt;/think&gt;</code> tag:</p>
<blockquote>
<p><strong>The Joke:</strong></p>
<p>A pelican and a walrus decide to open a quaint little tea room together. The walrus, with its big size, struggles to find comfortable chairs, so it sits on the table by accident, knocking over the teapot. Meanwhile, the pelican, trying to help, uses its beak to place saucers on the table, causing a few spills.</p>
<p>After a series of comical mishaps, the walrus looks up and says with a grin, "This isn't so fishy anymore." The pelican smirks and remarks, "Maybe not, but we do have a lot of krill in our tea!"</p>
<p><strong>Explanation:</strong></p>
<ul>
<li>
<strong>Setup:</strong> Pelican and Walrus run an unlikely tea room. Their sizes lead to comedic chaos.</li>
<li>
<strong>Punchline:</strong> "This isn't so fishy anymore" is a pun on the situation becoming less absurd. The follow-up joke introduces "krill," a play on words that ties into both marine life ("fish") and tea, making it humorous while fitting the theme.</li>
</ul>
</blockquote>
<p>So yeah, the joke is <em>awful</em>. But the process of getting there was such an interesting insight into how these new models work.</p>
<p>This was a relatively small 8B model. I'm looking forward to trying out the <a href="https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-70B">Llama 70B version</a>, which isn't yet available in a GGUF I can run with Ollama. Given <a href="https://simonwillison.net/2024/Dec/9/llama-33-70b/">the strength of Llama 3.3 70B</a> - currently my favourite GPT-4 class model that I've run on my own machine - I have high expectations.</p>

<p><strong>Update 21st January 2025</strong>: I got <a href="https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-70B-GGUF">this quantized version</a> of that Llama 3.3 70B R1 distilled model working like this - a 34GB download:</p>

<pre><code>ollama run hf.co/unsloth/DeepSeek-R1-Distill-Llama-70B-GGUF:Q3_K_M</code></pre>

<h4 id="can-it-draw-a-pelican-">Can it draw a pelican?</h4>
<p>I tried <a href="https://github.com/simonw/pelican-bicycle">my classic</a> <code>Generate an SVG of a pelican riding a bicycle</code> prompt too. It <a href="https://gist.github.com/simonw/ddd21a016cd7be74fd3e18407e1e313e">did not do very well</a>:</p>
<p><img src="https://static.simonwillison.net/static/2025/r1-peli-1.svg" alt="Blue square, abstract white shape on it" style="max-width: 100%;" /></p>
<p>It looked to me like it got the order of the elements wrong, so I followed up with:</p>
<blockquote>
<p><code>the background ended up covering the rest of the image</code></p>
</blockquote>
<p>It <a href="https://gist.github.com/simonw/ddd21a016cd7be74fd3e18407e1e313e#response-1">thought some more</a> and gave me this:</p>
<p><img src="https://static.simonwillison.net/static/2025/r1-peli-2.svg" alt="Blue square, abstract white shape on it" style="max-width: 100%;" /></p>
<p>As with the earlier joke, the chain of thought in the transcript was far more interesting than the end result.</p>

<h4 id="other-ways-to-try-deepseek-r1">Other ways to try DeepSeek-R1</h4>
<p>If you want to try the model out without installing anything at all you can do so using <a href="https://chat.deepseek.com/">chat.deepseek.com</a> - you'll need to create an account (sign in with Google, use an email address or provide a Chinese +86 phone number) and then select the "DeepThink" option below the prompt input box.</p>
<p><img src="https://static.simonwillison.net/static/2025/deepseek-chat-deepthink.jpg" alt="Screenshot of DeepSeek Chat showing the DeepThink selected icon" style="max-width: 100%;" /></p>
<p>DeepSeek offer the model via <a href="https://api-docs.deepseek.com/">their API</a>, using an OpenAI-imitating endpoint. You can access that via LLM by dropping this into <a href="https://llm.datasette.io/en/stable/other-models.html#openai-compatible-models">your extra-openai-models.yaml configuration file</a>:</p>
<div class="highlight highlight-source-yaml"><pre>- <span class="pl-ent">model_id</span>: <span class="pl-s">deepseek-reasoner</span>
  <span class="pl-ent">model_name</span>: <span class="pl-s">deepseek-reasoner</span>
  <span class="pl-ent">api_key_name</span>: <span class="pl-s">deepseek</span>
  <span class="pl-ent">api_base</span>: <span class="pl-s"><span class="pl-pds">"</span>https://api.deepseek.com<span class="pl-pds">"</span></span></pre></div>
<p>Then run <code>llm keys set deepseek</code> and paste in your API key, then use <code>llm -m deepseek-reasoner 'prompt'</code> to run prompts.</p>
<p>This won't show you the reasoning tokens, sadly. Those are served up by the API (<a href="https://gist.github.com/simonw/a5ca117dd0325c93a5b1f5a18c4a9e34">example here</a>) but LLM doesn't yet have a way to display them.</p>
<p>Since I published this article <a href="https://www.ollama.com/">Ollama</a> made available their own versions of the DeepSeek models. Confusingly, they've taken the various different distilled models and made them all available as different sizes of their <a href="https://ollama.com/library/deepseek-r1">deepseek-r1</a> - for example, their 9GB R1 Qwen2.5-14B model is called <code>deepseek-r1:14b</code> and can be run like this:</p>
<pre><code>ollama run deepseek-r1:14b
</code></pre>

<p>Using a browser that supports WebGPU such as Google Chrome you can visit <a href="https://huggingface.co/spaces/webml-community/deepseek-r1-webgpu">webml-community/deepseek-r1-webgpu</a> and load and then prompt a 1.28GB R1 model based on Qwen2.5-Math-1.5B entirely in your browser.</p>
<p><img src="https://static.simonwillison.net/static/2025/deepseek-webgpu.jpg" alt="Screenshot of the webml-community/deepseek-r1-webgpu space running a prompt: Solve the equation x^2 - 3x + 2 = 0. It thinks through the problem and produces a final answer of 1 and 2." style="max-width: 100%;" /></p>


guid: https://simonwillison.net/2025/Jan/22/office-hours-demos/#atom-entries
title: Six short video demos of LLM and Datasette projects
author: Simon Willison
url: https://simonwillison.net/2025/Jan/22/office-hours-demos/#atom-entries
feedurl: https://simonwillison.net/atom/entries/
content_mime_type: text/html
content:
<p>Last Friday Alex Garcia and I hosted a new kind of Datasette Public Office Hours session, inviting members of the Datasette community to share short demos of projects that they had built. The session lasted just over an hour and featured demos from six different people.</p>
<p>We broadcast live on YouTube, but I've now edited the session into separate videos. These are listed below, along with project summaries and show notes for each presentation.</p>
<p>You can also watch all six videos in <a href="https://www.youtube.com/playlist?list=PLSocEbMlNGotyeonEbgFP1_uf9gk1z7zm">this YouTube playlist</a>.</p>
<ul>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#llm-logs-feedback-by-matthias-l-bken">llm-logs-feedback by Matthias Lübken</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#llm-model-gateway-and-llm-consortium-by-thomas-hughes">llm-model-gateway and llm-consortium by Thomas Hughes</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#congressional-travel-explorer-with-derek-willis">Congressional Travel Explorer with Derek Willis</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#llm-questioncache-with-nat-knight">llm-questioncache with Nat Knight</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#improvements-to-datasette-enrichments-with-simon-willison">Improvements to Datasette Enrichments with Simon Willison</a></li>
  <li><a href="https://simonwillison.net/2025/Jan/22/office-hours-demos/#datasette-comments-pins-and-write-ui-with-alex-garcia">Datasette comments, pins and write UI with Alex Garcia</a></li>
</ul>
<h4 id="llm-logs-feedback-by-matthias-l-bken">llm-logs-feedback by Matthias Lübken</h4>
<p><lite-youtube videoid="9pEP6auZmvg"
  title="llm-logs-feedback by Matthias Lübken"
  playlabel="Play: llm-logs-feedback by Matthias Lübken"
> </lite-youtube></p>
<p><a href="https://github.com/luebken/llm-logs-feedback">llm-logs-feedback</a> is a plugin by Matthias Lübken for <a href="https://llm.datasette.io/">LLM</a> which adds the ability to store feedback on prompt responses, using new <code>llm feedback+1</code> and <code>llm feedback-1</code> commands. These also accept an optional comment, and the feedback is stored in a <code>feedback</code> table in SQLite.</p>
<p>You can install the plugin from PyPI like this:</p>
<div class="highlight highlight-source-shell"><pre>llm install llm-logs-feedback</pre></div>
<p>The full plugin implementation is in the <a href="https://github.com/luebken/llm-logs-feedback/blob/main/llm_logs_feedback.py">llm_logs_feedback.py file</a> in Matthias' GitHub repository.</p>
<h4 id="llm-model-gateway-and-llm-consortium-by-thomas-hughes">llm-model-gateway and llm-consortium by Thomas Hughes</h4>
<p><lite-youtube videoid="Th5WOyjuRdk"
  title="llm-model-gateway and llm-consortium by Thomas Hughes"
  playlabel="Play: llm-model-gateway and llm-consortium by Thomas Hughes"
> </lite-youtube></p>
<p>Tommy Hughes has been developing a whole array of LLM plugins, including his <a href="https://github.com/irthomasthomas/llm-plugin-generator">llm-plugin-generator</a> which is a plugin that can help write new plugins!</p>
<p>He started by demonstrating <a href="https://github.com/irthomasthomas/llm-model-gateway">llm-model-gateway</a>, a plugin that adds a <code>llm serve</code> command which starts a localhost server running an imitation of the OpenAI API against LLM models:</p>
<div class="highlight highlight-source-shell"><pre>llm install llm-model-gateway
llm serve</pre></div>
<p>Tommy's main demo was of <a href="https://github.com/irthomasthomas/llm-consortium">llm-consortium</a>, a plugin which can use a consortium of collaborating LLM models working together to solve problems.</p>
<div class="highlight highlight-source-shell"><pre>llm install llm-consortium
llm consortium <span class="pl-s"><span class="pl-pds">"</span>Best way to prepare avocado toast<span class="pl-pds">"</span></span> \
  --models claude-3.5-sonnet \
  --models gpt-4o \
  --arbiter gegemini-1.5-pro-latest \
  --confidence-threshold 0.8 \
  --max-iterations 3 \
  --output results.json</pre></div>
<p>I ran this and got back:</p>
<blockquote>
<p>The best way to prepare avocado toast involves selecting quality ingredients and careful preparation. Start with a thick slice of good quality bread, such as sourdough or whole grain. Toast it to your preferred level of crispness.  While the bread is toasting, prepare a ripe avocado. Cut it in half, remove the pit, and scoop the flesh into a bowl. Mash the avocado with a fork, leaving some chunks for texture. Season with salt, black pepper, and a squeeze of fresh lemon juice to prevent browning.  Optional additions include a touch of red pepper flakes.</p>
<p>Once the toast is ready, let it cool slightly before spreading the seasoned avocado evenly over it. Consider lightly rubbing a cut garlic clove on the warm toast for an extra layer of flavor (optional).</p>
<p>Enhance your avocado toast with your favorite toppings. Popular choices include: everything bagel seasoning, sliced tomatoes, radishes, a poached or fried egg (for added protein), microgreens, smoked salmon (for a more savory option), feta cheese crumbles, or a drizzle of hot sauce.  For a finishing touch, drizzle with high-quality olive oil and sprinkle with sesame or chia seeds for added texture.</p>
<p>Consider dietary needs when choosing toppings. For example, those following a low-carb diet might skip the tomatoes and opt for more protein and healthy fats.</p>
<p>Finally, pay attention to presentation. Arrange the toppings neatly for a visually appealing toast. Serve immediately to enjoy the fresh flavors and crispy toast.</p>
</blockquote>
<p>But the really interesting thing is the full log of the prompts and responses sent to Claude 3.5 Sonnet and GPT-4o, followed by a combined prompt to Gemini 1.5 Pro to have it arbitrate between the two responses. You can see <a href="https://gist.github.com/simonw/425f42f8ec1a963ae13c5b57ba580f56">the full logged prompts and responses here</a>. Here's that <a href="https://gist.github.com/simonw/e82370f0e5986a15823c82200c1b77f8">results.json</a> output file.</p>
<h4 id="congressional-travel-explorer-with-derek-willis">Congressional Travel Explorer with Derek Willis</h4>
<p><lite-youtube videoid="CDilLbFP1DY"
  title="Congressional Travel Explorer with Derek Willis"
  playlabel="Play: Congressional Travel Explorer with Derek Willis"
> </lite-youtube></p>
<p>Derek Willis teaches data journalism at the Philip Merrill College of Journalism at the University of Maryland. For a recent project his students built a <a href="https://cnsmaryland.org/interactives/fall-2024/congressional_travel_explorer/index.html">Congressional Travel Explorer</a> interactive using Datasette, AWS Extract and Claude 3.5 Sonnet to analyze travel disclosures from members of Congress.</p>
<p>One of the outcomes from the project was this story in Politico: <a href="https://www.politico.com/news/2024/10/30/israel-aipac-funded-congress-travel-00185167">Members of Congress have taken hundreds of AIPAC-funded trips to Israel in the past decade</a>.</p>
<h4 id="llm-questioncache-with-nat-knight">llm-questioncache with Nat Knight</h4>
<p><lite-youtube videoid="lXwfEYXjsak"
  title="llm-questioncache with Nat Knight"
  playlabel="Play: llm-questioncache with Nat Knight"
> </lite-youtube></p>
<p><a href="https://github.com/nathanielknight/llm-questioncache">llm-questioncache</a> builds on top of <a href="https://llm.datasette.io/">https://llm.datasette.io/</a> to cache answers to questions, using embeddings to return similar answers if they have already been stored.</p>
<p>Using embeddings for de-duplication of similar questions is an interesting way to apply LLM's <a href="https://llm.datasette.io/en/stable/embeddings/python-api.html">embeddings feature</a>.</p>
<h4 id="improvements-to-datasette-enrichments-with-simon-willison">Improvements to Datasette Enrichments with Simon Willison</h4>
<p><lite-youtube videoid="GumAgaYpda0"
  title="Improvements to Datasette Enrichments with Simon Willison"
  playlabel="Play: Improvements to Datasette Enrichments with Simon Willison"
> </lite-youtube></p>
<p>I've demonstrated improvements I've been making to Datasette's <a href="https://enrichments.datasette.io/">Enrichments</a> system over the past few weeks.</p>
<p>Enrichments allow you to apply an operation - such as geocoding, a QuickJS JavaScript transformation or an LLM prompt - against selected rows within a table.</p>
<p>The latest release of <a href="https://github.com/datasette/datasette-enrichments/releases/tag/0.5">datasette-enrichments</a> adds visible progress bars and the ability to pause, resume and cancel an enrichment job that is running against a table.</p>
<h4 id="datasette-comments-pins-and-write-ui-with-alex-garcia">Datasette comments, pins and write UI with Alex Garcia</h4>
<p><lite-youtube videoid="i0u4N6g15Zg"
  title="Datasette comments, pins and write UI with Alex Garcia"
  playlabel="Play: Datasette comments, pins and write UI with Alex Garcia"
> </lite-youtube></p>
<p>We finished with three plugin demos from Alex, showcasing collaborative features we have been developing for <a href="https://www.datasette.cloud/">Datasette Cloud</a>:</p>
<ul>
<li>
<a href="https://github.com/datasette/datasette-write-ui">datasette-write-ui</a> provides tools for editing and adding data to Datasette tables. A new feature here is the ability to shift-click a row to open the editing interface for that row.</li>
<li>
<a href="https://github.com/datasette/datasette-pins">datasette-pins</a> allows users to pin tables and databases to their Datasette home page, making them easier to find.</li>
<li>
<a href="https://github.com/datasette/datasette-comments">datasette-comments</a> adds a commenting interface to Datasette, allowing users to leave comments on individual rows in a table.</li>
</ul>


