From Twitter Threads to a 700-Page Textbook: The Story of 'Mathematics of Machine Learning'
An accidental journey: discover how a content creator's passion for explaining machine learning mathematics on Twitter evolved into a comprehensive 700-page textbook.
The author began writing online about mathematics and machine learning as a creative outlet, following the experience of co-founding an unsuccessful startup that consumed significant personal resources. A long-standing passion for teaching was evident early on; from explaining concepts to classmates as an undergraduate and serving as a teaching assistant for probability theory, to later spontaneously lecturing on the mathematics of machine learning and assisting graduate student colleagues with exam preparation in calculus and linear algebra during a computational biology research role.
Rejecting conventional wisdom to prioritize personal fulfillment over immediate financial gain, the author embarked on a writing project in 2021. This decision, driven by passion, proved to be profoundly rewarding.
In early 2021, with the machine learning community largely active on Twitter, the platform became a natural starting point for online writing. It offered a direct connection to the pulse of the technology world. Despite Twitter's 280-character limit, threads offered a way to publish longer content. Initially, writing about mathematics and machine learning in this format seemed unconventional, but it proved effective, compelling the author to distill complex topics into clear, concise segments, akin to poetic brevity.
At the time, high-quality technical content was a rarity on Twitter, with many creators chasing hype cycles from frontend development to generative AI and LLMs for maximum engagement. The author, however, aimed to distinguish their content by focusing on teaching and elevating the audience, rather than simply conforming to popular trends. Mathematical threads quickly gained traction, leading to explosive follower growth: from 300 to 1,000 in three months, and subsequently to 10,000 in another three months, after an initial three years to reach 300 followers.
One of the early, impactful threads is shown below, notably contributing to the initial surge past 1,000 followers.

As threads accumulated, it became evident that a substantial body of work was forming, resembling a book. The long-held dream of creating a definitive learning resource on the mathematics of machine learning was reignited, prompting consideration of formal book authorship.
Learning from a prior startup mistake of late product validation, the author launched an early access program for 'Mathematics of Machine Learning' via Gumroad in August 2021. Priced at $25 for chapters delivered incrementally, the program surpassed modest expectations, generating 33 sales ($825) within hours and 94 sales ($2350) in the first month – roughly doubling a postdoctoral researcher's salary at the time.
The first month sales of Mathematics of Machine Learning early access
The early sales validated the project's viability. (Despite this success, the initial scope quickly expanded, defying the 'start small' lesson from past ventures.)
Committed to completing the book, the author initially aimed for a chapter release every two years. However, the project demanded full-time effort, and the necessary marketing was significantly underestimated. Relying on strengths, the author continued publishing in-depth mathematical explanations on Twitter, discreetly linking to the book's early access. This strategy generated $1,000-$2,000 monthly, sufficient for living expenses, but effectively doubled the workload, dedicating half the time to content marketing and consequently slowing book progress. Paradoxically, this pressure honed the author's ability to write clear and engaging technical content, ultimately enhancing the book's quality.
The persistent need to publish and market also shaped a distinctive visual style. Recognizing illustrations as vital complements to technical explanations, considerable time was invested in creating drawings. This further divided efforts, allocating approximately one-third of time each to writing, social media content, and illustrations. While progress on the book slowed, the investment in visuals proved invaluable, becoming a defining characteristic of the work. (Notably, illustrations are created using Inkscape, not Manim.)
The acquisition of Twitter by Elon Musk and subsequent algorithm changes drastically impacted growth, burying threads and plummeting impressions. As Twitter was the primary source of readership, monthly revenue sharply declined from $1,000-$2,000 to $300-$600. Concurrently, extreme inflation in Hungary doubled living costs, creating a challenging financial situation.
Undaunted, the author adapted by transitioning to Substack, a promising platform offering direct creator-audience connection via email, immunity from algorithm changes, suitability for long-form technical content, and an independent paid subscription model. This marked the beginning of 'The Palindrome' publication.
Substack became a favored platform, with aspirations to build a leading science publication. However, this new venture further fragmented the author's focus. Balancing book writing with creating exclusive long-form content for 'The Palindrome' led to overextension. Despite 'The Palindrome's' healthy growth of approximately a thousand subscribers monthly, progress on the book stalled significantly.
After four years of writing and two years on Substack, the author realized they were effectively developing two distinct books: one focused on mathematics and another on machine learning. The mathematics section was already complete, with the combined content exceeding a thousand pages.
Common inquiries about the book's completion and physical availability highlighted the need for a publisher. This solution promised to alleviate the burden of balancing book writing, early access marketing, and Substack growth. Following an introduction, the author began collaborating with Packt, a partnership that has continued since.
As a first-time experience with a publisher, the author approached the collaboration cautiously, valuing independence. However, the experience with Packt proved exceptional. The publisher dedicated substantial effort to transforming the author's Jupyter Notebooks into a polished 700-page LaTeX project. Following six months of rigorous re-reading, editing, and formatting, 'Mathematics of Machine Learning' was successfully released, achieving immediate acclaim.
The success of the book is attributed to the readers who invest significant effort into mastering complex subjects like mathematics and machine learning. This accomplishment marks merely the beginning, with an encouraging message that perseverance always leads to success, regardless of the challenge.
The people who lifted the author up
The author acknowledges the profound impact of supportive friends throughout the journey. Alejandro Piad Morffis, an early Twitter connection, served as a significant inspiration for the author's own writing endeavors, eventually becoming a contributor to 'The Palindrome' and running 'The Computist Journal'. Santiago, a prominent tech account on Twitter and founder of ml.school, offered both inspiration and instruction, particularly through his rapid growth and approach to content creation. His early machine learning videos, featuring simple, effective hand-drawn illustrations, demonstrated a unique visual style and efficient execution. Santiago was also an early supporter of the 'Mathematics of Machine Learning' early access program and was invited to write the book's foreword, considered a mentor to the author. Levi, another friend from Twitter, with whom the author maintained contact and discussed various creative and business ideas, also provided mutual support.
Source: Introduction To Autoencoders In Machine Learning by Underfitted, Santiago’s YouTube channel
Gratitude is also extended to the Packt team and book reviewers (Tushar, Matthew, Shravan, Amit, Deepayan, Kushal, and Ankur) for their extensive contributions and dedication, which significantly enhanced the book's quality. More recently, Alberto Gonzalez played a crucial role in accelerating 'The Palindrome's' growth. Their collaboration, formed around the book's release, leveraged complementary skills—the author's focus on content creation and Alberto's expertise in audience reach—leading to a doubling of subscribers and a sixfold increase in paid subscriptions.

The author remains committed to the future of 'The Palindrome,' with aspirations for it to become the leading science publication on Substack.
The deepest gratitude is reserved for the author's mother, who passed away as the book project began. In one of their final conversations, she encouraged the author to pursue the book idea. Throughout life, various ambitious goals were met with skepticism from others, who often suggested more conventional career paths. However, the author's mother was the sole unwavering supporter, embodying the belief that determination leads to achievement.