Skip to content

Commit 0e0c5c9

Browse files
committed
upd. math. betterexplained. part 2 - arithmetic.
1 parent 7d8321f commit 0e0c5c9

24 files changed

Lines changed: 1610 additions & 57 deletions

File tree

blog/content/post/math-better-explained-arithmetic/index.en.md

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "BetterExplained - Part 2 - Arithmetic"
3-
description: "Mental math tricks: road speed and work hours in a year"
3+
description: >-
4+
Numbers (N, Z, Q, R), their properties and relations, operations
5+
<span class="op-pairs"><span class="op-pair">+ and −</span><span class="op-pair">× and /</span><span class="op-pair">\(a^{b}\) and \(\sqrt[n]{a}\)</span></span>
46
date: "2026-06-01"
57
slug: "math-better-explained-arithmetic"
68
tags:
@@ -14,6 +16,8 @@ image: cover.jpg
1416

1517
{{< accordion_controls expand="Expand all" collapse="Collapse all" >}}
1618

19+
{{< accordion_group_open >}}
20+
1721
### 60 km/h is 1 km per minute {.toc-heading-only}
1822

1923
<details class="post-accordion">
@@ -109,3 +113,128 @@ What’s 43% of 200? The same as 200% of 43: 86.
109113

110114
</div>
111115
</details>
116+
117+
{{< accordion_group_close >}}
118+
119+
## Sum from 1 to n
120+
121+
{{< accordion_controls expand="Expand all" collapse="Collapse all" >}}
122+
123+
{{< accordion_group_open >}}
124+
125+
### We're usually just given the formula and told to memorize it {.toc-heading-only}
126+
127+
<details class="post-accordion">
128+
<summary>We're usually just given the formula and told to memorize it</summary>
129+
<div>
130+
131+
\[
132+
\text{Sum from 1 to } n = \frac{n(n+1)}{2}
133+
\]
134+
135+
\[
136+
\text{Sum from 1 to 100} = \frac{100(100+1)}{2} = (50)(101) = 5050
137+
\]
138+
139+
But to build **intuition** and really understand it, you need to **derive the formula yourself**.
140+
141+
Below are four ways to derive it.
142+
143+
</div>
144+
</details>
145+
146+
### 1) Split the sequence in half and add in pairs {.toc-heading-only}
147+
148+
<details class="post-accordion">
149+
<summary>1) Split the sequence in half and add in pairs</summary>
150+
<div>
151+
152+
```
153+
1 2 3 4 5
154+
10 9 8 7 6
155+
```
156+
157+
Each vertical pair has the same sum: \(1 + 10 = 2 + 9 = \ldots = n + 1\). There are \(\frac{n}{2}\) pairs.
158+
159+
\[
160+
\text{Number of pairs} \times \text{sum of each pair} = \frac{n}{2}(n+1) = \frac{n(n+1)}{2}
161+
\]
162+
163+
</div>
164+
</details>
165+
166+
### 2) Two rows of numbers {.toc-heading-only}
167+
168+
<details class="post-accordion">
169+
<summary>2) Two rows of numbers</summary>
170+
<div>
171+
172+
```
173+
1 2 3 4 5 6 7 8 9 10
174+
10 9 8 7 6 5 4 3 2 1
175+
```
176+
177+
Add **both** rows: every column sums to \(n + 1\), and there are \(n\) columns:
178+
179+
\[
180+
\text{Sum of both rows} = n(n+1)
181+
\]
182+
183+
We only want **one** row, so divide by 2:
184+
185+
\[
186+
\frac{n(n+1)}{2}
187+
\]
188+
189+
</div>
190+
</details>
191+
192+
### 3) Picture a triangle {.toc-heading-only}
193+
194+
<details class="post-accordion">
195+
<summary>3) Picture a triangle</summary>
196+
<div>
197+
198+
```
199+
x
200+
x x
201+
x x x
202+
x x x x
203+
x x x x x
204+
```
205+
206+
\(n\) rows, row \(k\) has \(k\) cells — \(1 + 2 + \ldots + n\) in total. Imagine fitting two such triangles together tooth-to-tooth to form a rectangle. **Derive the formula yourself** from that picture.
207+
208+
</div>
209+
</details>
210+
211+
### 4) Via the average — the most interesting one, in my view {.toc-heading-only}
212+
213+
<details class="post-accordion">
214+
<summary>4) Via the average — the most interesting one, in my view</summary>
215+
<div>
216+
217+
We all know that
218+
219+
\[
220+
\text{average} = \frac{\text{sum}}{\text{number of items}}
221+
\]
222+
223+
which we can rewrite as
224+
225+
\[
226+
\text{sum} = \text{average} \times \text{number of items}
227+
\]
228+
229+
For \(1, 2, \ldots, n\) the average is easy to eyeball from the **middle** of the range: \(\frac{n+1}{2}\). There are \(n\) items, so:
230+
231+
\[
232+
\text{sum} = \frac{n+1}{2} \cdot n = \frac{n(n+1)}{2}
233+
\]
234+
235+
For \(1 \ldots 100\): average \(\approx 50.5\), sum \(50.5 \times 100 = 5050\).
236+
237+
</div>
238+
</details>
239+
240+
{{< accordion_group_close >}}

blog/content/post/math-better-explained-arithmetic/index.md

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "BetterExplained - часть 2 - Арифметика"
3-
description: "Ментальные трюки: скорость на дороге и рабочие часы в году"
3+
description: >-
4+
Числа (N, Z, Q, R), их свойства и отношения, операции
5+
<span class="op-pairs"><span class="op-pair">+ и −</span><span class="op-pair">× и /</span><span class="op-pair">\(a^{b}\) и \(\sqrt[n]{a}\)</span></span>
46
date: "2026-06-01"
57
slug: "math-better-explained-arithmetic"
68
tags:
@@ -14,6 +16,8 @@ image: cover.jpg
1416

1517
{{< accordion_controls expand="Развернуть все" collapse="Свернуть все" >}}
1618

19+
{{< accordion_group_open >}}
20+
1721
### 60 км/ч — это 1 км в минуту {.toc-heading-only}
1822

1923
<details class="post-accordion">
@@ -109,3 +113,128 @@ image: cover.jpg
109113

110114
</div>
111115
</details>
116+
117+
{{< accordion_group_close >}}
118+
119+
## Подсчет суммы от 1 до n
120+
121+
{{< accordion_controls expand="Развернуть все" collapse="Свернуть все" >}}
122+
123+
{{< accordion_group_open >}}
124+
125+
### Нам обычно просто дают формулу и говорят запомнить {.toc-heading-only}
126+
127+
<details class="post-accordion">
128+
<summary>Нам обычно просто дают формулу и говорят запомнить</summary>
129+
<div>
130+
131+
\[
132+
\text{Сумма от 1 до } n = \frac{n(n+1)}{2}
133+
\]
134+
135+
\[
136+
\text{Сумма от 1 до 100} = \frac{100(100+1)}{2} = (50)(101) = 5050
137+
\]
138+
139+
Но чтобы добиться **интуиции** и понять её, надо **вывести эту формулу самому**.
140+
141+
Ниже — четыре техники выведения.
142+
143+
</div>
144+
</details>
145+
146+
### 1) Делим массив пополам и складываем парами {.toc-heading-only}
147+
148+
<details class="post-accordion">
149+
<summary>1) Делим массив пополам и складываем парами</summary>
150+
<div>
151+
152+
```
153+
1 2 3 4 5
154+
10 9 8 7 6
155+
```
156+
157+
Каждая вертикальная пара даёт одну и ту же сумму: \(1 + 10 = 2 + 9 = \ldots = n + 1\). Пар ровно \(\frac{n}{2}\).
158+
159+
\[
160+
\text{Число пар} \times \text{сумма каждой пары} = \frac{n}{2}(n+1) = \frac{n(n+1)}{2}
161+
\]
162+
163+
</div>
164+
</details>
165+
166+
### 2) Два ряда чисел {.toc-heading-only}
167+
168+
<details class="post-accordion">
169+
<summary>2) Два ряда чисел</summary>
170+
<div>
171+
172+
```
173+
1 2 3 4 5 6 7 8 9 10
174+
10 9 8 7 6 5 4 3 2 1
175+
```
176+
177+
Складываем **оба** ряда: в каждом столбце снова \(n + 1\), столбцов \(n\) штук — итого:
178+
179+
\[
180+
\text{Сумма двух рядов} = n(n+1)
181+
\]
182+
183+
Нужна сумма **одного** ряда, поэтому делим на 2:
184+
185+
\[
186+
\frac{n(n+1)}{2}
187+
\]
188+
189+
</div>
190+
</details>
191+
192+
### 3) Представить треугольник {.toc-heading-only}
193+
194+
<details class="post-accordion">
195+
<summary>3) Представить треугольник</summary>
196+
<div>
197+
198+
```
199+
x
200+
x x
201+
x x x
202+
x x x x
203+
x x x x x
204+
```
205+
206+
\(n\) строк, в \(k\)-й строке \(k\) «клеток» — всего \(1 + 2 + \ldots + n\) единиц. Представьте, что складываете два таких треугольника «зуб к зубу» и получаете прямоугольник. **Формулу постройте сами** из этой картинки.
207+
208+
</div>
209+
</details>
210+
211+
### 4) Через среднее — самая интересная, на мой взгляд {.toc-heading-only}
212+
213+
<details class="post-accordion">
214+
<summary>4) Через среднее — самая интересная, на мой взгляд</summary>
215+
<div>
216+
217+
Все знают:
218+
219+
\[
220+
\text{среднее} = \frac{\text{сумма}}{\text{число элементов}}
221+
\]
222+
223+
Перепишем:
224+
225+
\[
226+
\text{сумма} = \text{среднее} \times \text{число элементов}
227+
\]
228+
229+
Для ряда \(1, 2, \ldots, n\) среднее можно взять «на глаз» — из **центра** ряда: это \(\frac{n+1}{2}\). Элементов \(n\) штук, значит:
230+
231+
\[
232+
\text{сумма} = \frac{n+1}{2} \cdot n = \frac{n(n+1)}{2}
233+
\]
234+
235+
Для \(1 \ldots 100\): среднее \(\approx 50{,}5\), сумма \(50{,}5 \times 100 = 5050\).
236+
237+
</div>
238+
</details>
239+
240+
{{< accordion_group_close >}}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<div class="article-details">
2+
{{ if .Params.categories }}
3+
<header class="article-category">
4+
{{ range (.GetTerms "categories") }}
5+
<a href="{{ .RelPermalink }}" {{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
6+
{{ .LinkTitle }}
7+
</a>
8+
{{ end }}
9+
</header>
10+
{{ end }}
11+
12+
<div class="article-title-wrapper">
13+
<h2 class="article-title">
14+
<a href="{{ .RelPermalink }}">
15+
{{- .Title -}}
16+
</a>
17+
</h2>
18+
19+
{{ with .Params.description }}
20+
<h3 class="article-subtitle">
21+
{{ . | safeHTML }}
22+
</h3>
23+
{{ end }}
24+
</div>
25+
26+
{{ $showReadingTime := .Params.readingTime | default (.Site.Params.article.readingTime) }}
27+
{{ $showDate := not .Date.IsZero }}
28+
{{ $showFooter := or $showDate $showReadingTime }}
29+
{{ if $showFooter }}
30+
<footer class="article-time">
31+
{{ if $showDate }}
32+
<div>
33+
{{ partial "helper/icon" "date" }}
34+
<time class="article-time--published">
35+
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
36+
</time>
37+
</div>
38+
{{ end }}
39+
40+
{{ if $showReadingTime }}
41+
<div>
42+
{{ partial "helper/icon" "clock" }}
43+
<time class="article-time--reading">
44+
{{ T "article.readingTime" .ReadingTime }}
45+
</time>
46+
</div>
47+
{{ end }}
48+
</footer>
49+
{{ end }}
50+
51+
{{ if .IsTranslated }}
52+
<footer class="article-translations">
53+
{{ partial "helper/icon" "language" }}
54+
<div>
55+
{{ range .Translations }}
56+
<a href="{{ .Permalink }}" class="link">{{ .Language.LanguageName }}</a>
57+
{{ end }}
58+
</div>
59+
</footer>
60+
{{ end }}
61+
</div>

blog/layouts/shortcodes/accordion_controls.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
document.addEventListener("click", function (e) {
1616
var btn = e.target.closest(".accordion-toggle-all");
1717
if (!btn) return;
18-
var article = btn.closest(".article-content");
19-
if (!article) return;
18+
var controls = btn.closest(".accordion-controls");
19+
if (!controls) return;
20+
var group = controls.nextElementSibling;
21+
if (!group || !group.classList.contains("post-accordion-group")) return;
2022
var open = btn.dataset.action === "expand";
21-
article.querySelectorAll("details.post-accordion").forEach(function (d) {
23+
group.querySelectorAll("details.post-accordion").forEach(function (d) {
2224
d.open = open;
2325
});
2426
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div class="post-accordion-group">

0 commit comments

Comments
 (0)