TL;DR: A stand-alone HTML file contains an interactive app that implements the 3Blue1Brown demonstration of Bayes’ Theorem as the geometry of changing beliefs. This app complements an existing alternative app.
One of my favorite YouTube channels is Grant Sanderson’s 3Blue1Brown. The channel’s intellectually inspiring videos have set the standard for visualizing mathematics. Of course, my attention has been drawn in particular to the videos on Bayes’ theorem. One of these videos, “Bayes theorem, the geometry of changing beliefs,” has been viewed almost 6 million times to date.
In this video, Sanderson uses a simple square to represent the joint space of hypotheses and events, and then shows how observing events restricts the square, which can be interpreted as an update of beliefs. I felt that this demonstration, together with the cover story highlighting the impact of prior knowledge, could be very useful for students. But it would be even better if students could interact with the visualization themselves, and plug in their own examples. In the days of yore, programming such an app would take considerable time and effort. Today, it took a single substantive prompt and about 13 minutes of processing in ChatGPT Pro.
Specifically, this is how the app came to be. First I asked ChatGPT Pro:
Do you know the YouTube video from 3Blue1Brown, “Bayes theorem, the geometry of changing beliefs”?
After it responded affirmatively, I gave it the order:
Well I was hoping you could make an app that provides the same intuition as the website! It would also be good to show a sequential step, so how the restricted proportions are normalized to yield a new square with adjusted prior probabilities. It may also be good to change the example to something more standard — or allow different examples. Please create the app as a stand-alone html file.
After 13 minutes and 6 seconds, ChatGPT produced the HTML file that contains the app. This is a screenshot of the key part of the GUI:
Perhaps ChatGPT chose the color scheme to acknowledge the source of inspiration :-). Also –and I think this would appeal to Sanderson himself– the app contains a cool visualization of how the observation of an event updates the square so that “today’s posterior is tomorrow’s prior” (Lindley, 1972, p. 2). Just click “Play transformation” in the app to see the selected rectangles morph into a new square, then “Use … as next prior” to continue with another observation. As the screenshot below shows, the app also keeps track of the sequential updates:
Finally, the app provides a written explanation of what was done:
Of course the app can be improved with a few more prompts, but I am actually quite impressed with the one-shot solution. But there is more. When I asked ChatGPT to check the contents of this blogpost, it informed me that an interactive app already exists! This app is linked in the description of the YouTube video (I hadn’t checked) and it is available here. This existing app does a better job in displaying the information and has some neat sliders. In contrast, the ChatGPT app has a nice visualization of the updating process, so I view the two apps as complementary and I hope that both apps can help the student better understand Bayes’ rule.
So this is what ChatGPT did for this mini-project:
- It created an interactive app with all of the bells and whistles;
- It pointed out about 10 mistakes in an initial draft of this blogpost (mostly typos and syntax);
- It identified an existing interactive app.
It is clear that when it comes to visualizing mathematics and statistics, AI offers existing new opportunities that can great benefit our students. You can check out the ChatGPT app here!
References
3Blue1Brown (2019). Bayes theorem, the geometry of changing beliefs. YouTube.
Lindley, D. V. (1972). Bayesian statistics, a review. Philadelphia, PA: SIAM.
Eric-Jan Wagenmakers
Eric-Jan (EJ) Wagenmakers is professor at the Psychological Methods Group at the University of Amsterdam.






