-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmt1s.tex
executable file
·2124 lines (1924 loc) · 87.9 KB
/
mt1s.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[numbers=enddot,12pt,final,onecolumn,notitlepage]{scrartcl}%
\usepackage[headsepline,footsepline,manualmark]{scrlayer-scrpage}
\usepackage[all,cmtip]{xy}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{framed}
\usepackage{comment}
\usepackage{color}
\usepackage{hyperref}
\usepackage{ifthen}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{needspace}
\usepackage{tabls}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Friday, September 16, 2016 20:39:00}
%TCIDATA{SuppressPackageManagement}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Language=American English}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\newcounter{exer}
\theoremstyle{definition}
\newtheorem{theo}{Theorem}[section]
\newenvironment{theorem}[1][]
{\begin{theo}[#1]\begin{leftbar}}
{\end{leftbar}\end{theo}}
\newtheorem{lem}[theo]{Lemma}
\newenvironment{lemma}[1][]
{\begin{lem}[#1]\begin{leftbar}}
{\end{leftbar}\end{lem}}
\newtheorem{prop}[theo]{Proposition}
\newenvironment{proposition}[1][]
{\begin{prop}[#1]\begin{leftbar}}
{\end{leftbar}\end{prop}}
\newtheorem{defi}[theo]{Definition}
\newenvironment{definition}[1][]
{\begin{defi}[#1]\begin{leftbar}}
{\end{leftbar}\end{defi}}
\newtheorem{remk}[theo]{Remark}
\newenvironment{remark}[1][]
{\begin{remk}[#1]\begin{leftbar}}
{\end{leftbar}\end{remk}}
\newtheorem{coro}[theo]{Corollary}
\newenvironment{corollary}[1][]
{\begin{coro}[#1]\begin{leftbar}}
{\end{leftbar}\end{coro}}
\newtheorem{conv}[theo]{Convention}
\newenvironment{condition}[1][]
{\begin{conv}[#1]\begin{leftbar}}
{\end{leftbar}\end{conv}}
\newtheorem{quest}[theo]{Question}
\newenvironment{algorithm}[1][]
{\begin{quest}[#1]\begin{leftbar}}
{\end{leftbar}\end{quest}}
\newtheorem{warn}[theo]{Warning}
\newenvironment{conclusion}[1][]
{\begin{warn}[#1]\begin{leftbar}}
{\end{leftbar}\end{warn}}
\newtheorem{conj}[theo]{Conjecture}
\newenvironment{conjecture}[1][]
{\begin{conj}[#1]\begin{leftbar}}
{\end{leftbar}\end{conj}}
\newtheorem{exam}[theo]{Example}
\newenvironment{example}[1][]
{\begin{exam}[#1]\begin{leftbar}}
{\end{leftbar}\end{exam}}
\newtheorem{exmp}[exer]{Exercise}
\newenvironment{exercise}[1][]
{\begin{exmp}[#1]\begin{leftbar}}
{\end{leftbar}\end{exmp}}
\newenvironment{statement}{\begin{quote}}{\end{quote}}
\iffalse
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\fi
\let\sumnonlimits\sum
\let\prodnonlimits\prod
\let\cupnonlimits\bigcup
\let\capnonlimits\bigcap
\renewcommand{\sum}{\sumnonlimits\limits}
\renewcommand{\prod}{\prodnonlimits\limits}
\renewcommand{\bigcup}{\cupnonlimits\limits}
\renewcommand{\bigcap}{\capnonlimits\limits}
\setlength\tablinesep{3pt}
\setlength\arraylinesep{3pt}
\setlength\extrarulesep{3pt}
\voffset=0cm
\hoffset=-0.7cm
\setlength\textheight{22.5cm}
\setlength\textwidth{15.5cm}
\newenvironment{verlong}{}{}
\newenvironment{vershort}{}{}
\newenvironment{noncompile}{}{}
\excludecomment{verlong}
\includecomment{vershort}
\excludecomment{noncompile}
\newcommand{\id}{\operatorname{id}}
\newcommand{\rev}{\operatorname{rev}}
\newcommand{\conncomp}{\operatorname{conncomp}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\powset}[2][]{\ifthenelse{\equal{#2}{}}{\mathcal{P}\left(#1\right)}{\mathcal{P}_{#1}\left(#2\right)}}
% $\powset[k]{S}$ stands for the set of all $k$-element subsets of
% $S$. The argument $k$ is optional, and if not provided, the result
% is the whole powerset of $S$.
\newcommand{\set}[1]{\left\{ #1 \right\}}
% $\set{...}$ yields $\left\{ ... \right\}$.
\newcommand{\abs}[1]{\left| #1 \right|}
% $\abs{...}$ yields $\left| ... \right|$.
\newcommand{\tup}[1]{\left( #1 \right)}
% $\tup{...}$ yields $\left( ... \right)$.
\newcommand{\ive}[1]{\left[ #1 \right]}
% $\ive{...}$ yields $\left[ ... \right]$.
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
% $\floor{...}$ yields $\left\lfloor ... \right\rfloor$.
\newcommand{\verts}[1]{\operatorname{V}\left( #1 \right)}
% $\verts{...}$ yields $\operatorname{V}\left( ... \right)$.
\newcommand{\edges}[1]{\operatorname{E}\left( #1 \right)}
% $\edges{...}$ yields $\operatorname{E}\left( ... \right)$.
\newcommand{\arcs}[1]{\operatorname{A}\left( #1 \right)}
% $\arcs{...}$ yields $\operatorname{A}\left( ... \right)$.
\newcommand{\underbrack}[2]{\underbrace{#1}_{\substack{#2}}}
% $\underbrack{...1}{...2}$ yields
% $\underbrace{...1}_{\substack{...2}}$. This is useful for doing
% local rewriting transformations on mathematical expressions with
% justifications.
\ihead{Math 5707 Spring 2017 (Darij Grinberg): midterm 1}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\begin{center}
\textbf{Math 5707 Spring 2017 (Darij Grinberg): midterm 1}
\textbf{Solution sketches (DRAFT).}
\end{center}
\tableofcontents
\subsection{Reminders}
See the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/nogra.pdf}{lecture notes}
and also the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/}{handwritten notes}
for relevant material.
See also
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw2s.pdf}{the solutions to homework set 2}
for various conventions and notations that are in use here.
\subsection{Exercise \ref{exe.mt1.from-dom}: a from-dominating set
from a Hamiltonian path}
\begin{exercise} \label{exe.mt1.from-dom}
Let $D = \tup{V, A}$ be a digraph. A \textit{from-dominating set} of
$D$ shall mean a subset $S$ of $V$ such that for each vertex $v \in
V \setminus S$, there exists at least one arc $uv \in A$ with
$u \in S$.
Assume that $D$ has a Hamiltonian path. Prove that $D$ has a
from-dominating set of size $\leq \dfrac{\abs{V}+1}{2}$.
\end{exercise}
\begin{proof}[Solution sketch to Exercise~\ref{exe.mt1.from-dom}.]
We have assumed that $D$ has a Hamiltonian path. Fix such a path, and
denote it by $\tup{v_1, v_2, \ldots, v_n}$.
Each vertex of $D$ appears exactly once in the path
$\tup{v_1, v_2, \ldots, v_n}$ (since $\tup{v_1, v_2, \ldots, v_n}$ is
a Hamiltonian path). In other words, each element of $V$ appears
exactly once in the path $\tup{v_1, v_2, \ldots, v_n}$. Hence,
$\abs{V} = n$ and $V = \set{v_1, v_2, \ldots, v_n}$.
Define a subset $S$ of $V$ by
\[
S = \set{v_i \ \mid \ i \in \set{1,2,\ldots,n} \text{ is odd}}
= \set{v_1, v_3, v_5, \ldots}.
\]
Then,\footnote{Here, we are using the following notation: If $x$ is a
real number, then $\floor{x}$ denotes the largest integer that is
smaller or equal to $x$. For example, $\floor{2.8} = 2$ and
$\floor{3} = 3$ and $\floor{-1.6} = -2$.}
$\abs{S} = \floor{\dfrac{n+1}{2}} \leq \dfrac{n+1}{2}
= \dfrac{\abs{V}+1}{2}$ (since $n = \abs{V}$). Hence, the set $S$ has
size $\leq \dfrac{\abs{V}+1}{2}$. It thus merely remains to prove that
$S$ is from-dominating.
According to the definition of ``from-dominating'', this means proving
that for each vertex $v \in V \setminus S$, there exists at least one
arc $uv \in A$ with $u \in S$. So let us prove this now.
Let $v \in V \setminus S$. Thus,
\begin{align*}
v &\in V \setminus S
= \set{v_1, v_2, \ldots, v_n} \setminus
\set{v_1, v_3, v_5, \ldots} \\
&\qquad
\left( \text{since } V = \set{v_1, v_2, \ldots, v_n} \text{ and }
S = \set{v_1, v_3, v_5, \ldots} \right) \\
&= \set{v_2, v_4, v_6, \ldots}
= \set{v_i \ \mid \ i \in \set{1,2,\ldots,n} \text{ is even}} .
\end{align*}
In other words, $v = v_i$ for some even $i \in \set{1,2,\ldots,n}$.
Consider this $i$. The integer $i$ is even and positive; hence, the
integer $i-1$ is odd and positive. Hence,
$i-1 \in \set{1,2,\ldots,n-1}$ (since $i-1 < i \leq n$), so that
$i-1 \in \set{1, 2, \ldots, n}$.
Thus, $v_{i-1} \in \set{v_1, v_3, v_5, \ldots}$ (since $i-1$ is odd).
Hence, $v_{i-1} \in \set{v_1, v_3, v_5, \ldots} = S$.
Furthermore, recall that $\tup{v_1, v_2, \ldots, v_n}$ is a path in
$D$. Thus, $v_j v_{j+1}$ is an arc of $D$ for each
$j \in \set{1,2,\ldots,n-1}$. Applying this to $j=i-1$, we conclude
that $v_{i-1} v_i$ is an arc of $D$. In other words,
$v_{i-1} v_i \in A$. Since $v_i = v$, this rewrites as
$v_{i-1} v \in A$. Hence, there exists at least one arc $uv \in A$
with $u \in S$ (namely, the arc $v_{i-1} v$ with $u = v_{i-1}$).
This is exactly what we wanted to prove. Hence, we have shown that $S$
is from-dominating.
\end{proof}
\subsection{Exercise \ref{exe.mt1.L-hamil}: Hamiltonian paths of a
line graph}
\begin{exercise} \label{exe.mt1.L-hamil}
Let $G = \tup{V, E}$ be a simple graph. The \textit{line graph}
$L \tup{G}$ is defined as the simple graph $\tup{E, F}$, where
\[
F = \set{ \set{e_1, e_2} \in \powset[2]{E}
\ \mid \ e_1 \cap e_2 \neq \varnothing } .
\]
(In other words, $L \tup{G}$ is the graph whose \textbf{vertices}
are the \textbf{edges} of $G$, and in which two vertices $e_1$ and
$e_2$ are adjacent if and only if the edges $e_1$ and $e_2$ of $G$
share a common vertex.)
Assume that $\abs{V} > 1$.
\textbf{(a)} If $G$ has a Hamiltonian path, then prove that
$L \tup{G}$ has a Hamiltonian path.
\textbf{(b)} If $G$ has a Eulerian walk, then prove that $L \tup{G}$
has a Hamiltonian path.
\end{exercise}
\begin{proof}[Hints to Exercise~\ref{exe.mt1.L-hamil}.]
\textbf{(a)} Let $\tup{v_0, v_1, \ldots, v_n}$ be a Hamiltonian path
in $G$.
Let $e_1, e_2, \ldots, e_n$ be the edges of this path (so that
$e_i = v_{i-1} v_i$ for each $i$). Then,
$\mathbf{p} = \tup{e_1, e_2, \ldots, e_n}$ is a path in $L \tup{G}$.
This path is
not necessarily a Hamiltonian path; but we can turn it into a
Hamiltonian path by the following procedure:
\begin{itemize}
\item Insert all edges of $G$ that contain $v_0$ and are not already
in the path $\mathbf{p}$ into $\mathbf{p}$, placing them
at the beginning of $\mathbf{p}$ (just before $e_1$).
\item Insert all edges of $G$ that contain $v_1$ and are not already
in the path $\mathbf{p}$ into $\mathbf{p}$, placing them
between $e_1$ and $e_2$.
\item Insert all edges of $G$ that contain $v_2$ and are not already
in the path $\mathbf{p}$ into $\mathbf{p}$, placing them
between $e_2$ and $e_3$.
\item And so on, until all edges of $G$ have been inserted.
\end{itemize}
It is easy to check that the result is a Hamiltonian path in
$L \tup{G}$.
\textbf{(b)} Let $e_1, e_2, \ldots, e_m$ be the edges of an Eulerian
walk in $G$. Then, $\tup{e_1, e_2, \ldots, e_m}$ is a Hamiltonian
path in $L \tup{G}$.
[\textit{Remark:} It is also true that if $G$ has an Eulerian circuit,
then $L \tup{G}$ has an Eulerian circuit. To prove this, show that
$L \tup{G}$ is connected and that each vertex of $L \tup{G}$ has even
degree.]
\end{proof}
\subsection{Exercise \ref{exe.mt1.deg-cycle-dir}: a condition for a
digraph to have a cycle}
\begin{exercise} \label{exe.mt1.deg-cycle-dir}
Let $D = \tup{V, A}$ be a digraph with $\abs{V} > 0$. Assume
that each vertex $v \in V$ satisfies $\deg^- v > 0$. Prove that
$D$ has at least one cycle.
(Keep in mind that a length-1 circuit $\tup{v, v}$ counts as a cycle
when $A$ contains the loop $\tup{v, v}$.)
\end{exercise}
\begin{proof}[Hints to Exercise~\ref{exe.mt1.deg-cycle-dir}.]
Fix a longest path $\tup{v_0, v_1, \ldots, v_k}$ in $D$.
There is at least one arc with target
$v_0$ (since $\deg^- \tup{v_0} > 0$). Let $v_{-1}$ be the source of
this arc. Then, $\tup{v_{-1}, v_0, v_1, \ldots, v_k}$ is a walk, but
not a path (since $\tup{v_0, v_1, \ldots, v_k}$ is a longest path).
Hence, $v_{-1} = v_i$ for some $i \in \set{0, 1, \ldots, k}$.
Fix the \textbf{smallest} such $i$.
Then, $\tup{v_{-1}, v_0, \ldots, v_i}$ is a cycle.
[\textit{Remark:} This is very similar to Lemma 0.2 in
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw2s.pdf}{the solutions to homework set 2}.]
\end{proof}
\subsection{Exercise \ref{exe.mt1.deg-cycle-2}: a condition for a
multigraph to have a cycle}
Recall that the degree $\deg v$ of a vertex $v$ of a multigraph $G$
is defined as the number of all edges of $G$ containing $v$.
\begin{exercise} \label{exe.mt1.deg-cycle-2}
Let $G$ be a multigraph with at least one edge.
Assume that each vertex of $G$ has even degree.
Prove that $G$ has a cycle.
\end{exercise}
\begin{proof}[Hints to Exercise~\ref{exe.mt1.deg-cycle-2}.]
Fix a longest path
$\tup{v_0, e_1, v_1, e_2, v_2, \ldots, e_k, v_k}$ in $G$.
There is at least one edge containing $v_0$ (namely, $e_1$).
Thus, the number $\deg \tup{v_0}$ is positive.
This number $\deg \tup{v_0}$ is furthermore even (since each
vertex of $G$ has even degree).
Hence, this number $\deg \tup{v_0}$ is $\geq 2$
(because it is even and positive).
In other words, there are at least two edges containing $v_0$.
Thus, there is at least one edge containing $v_0$ that is distinct
from $e_1$.
Denote this edge by $e_0$, and let $v_{-1}$ be its other endpoint.
Then, $\tup{v_{-1}, e_0, v_0, e_1, v_1, e_2, v_2, \ldots, e_k, v_k}$
is a walk, but not a path (since
$\tup{v_0, e_1, v_1, e_2, v_2, \ldots, e_k, v_k}$ is a longest path).
Hence, $v_{-1} = v_i$ for some $i \in \set{0, 1, \ldots, k}$.
Fix the \textbf{smallest} such $i$.
Then,
$\tup{v_{-1}, e_0, v_0, e_1, v_1, \ldots, e_i, v_i}$ is a cycle.
[\textit{Remark:} This is (so to speak) the undirected version of
Lemma 0.2 in
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw2s.pdf}{the solutions to homework set 2}.]
\end{proof}
\subsection{Exercise \ref{exe.mt1.enmity}: a coloring where neighbors
shun equal colors}
\begin{exercise} \label{exe.mt1.enmity}
Let $k \in \NN$. Let $p_1, p_2, \ldots, p_k$ be $k$ nonnegative
real numbers such that $p_1 + p_2 + \cdots + p_k \geq 1$.
Let $G = \tup{V, E}$ be a simple graph. A \textit{$k$-coloring} of $G$
shall mean a map $f : V \to \set{1, 2, \ldots, k}$.
Prove that there exists a
$k$-coloring $f$ of $G$ with the following property: For each vertex
$v \in V$, at most $p_{f\tup{v}} \deg v$ neighbors of $v$ have the
same color
as $v$. Here, the \textit{color} of a vertex $w \in V$ (under the
$k$-coloring $f$) means the value $f\tup{w}$.
\end{exercise}
\begin{proof}[Hints to Exercise~\ref{exe.mt1.enmity}.]
This is a generalization of Exercise 1 on
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw0s.pdf}{homework set 0}.
Indeed, you obtain the latter exercise if you set $k = 2$, $p_1 = 1/2$
and $p_2 = 1/2$.
To solve Exercise~\ref{exe.mt1.enmity}, we can generalize the solution
of Exercise 1 on
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw0s.pdf}{homework set 0}.
Four changes need to be made:
\begin{enumerate}
\item We need to deal with the cases $k \leq 1$ separately.
\item In the algorithm, we need to explain how precisely to ``flip''
the color $f\tup{v}$ of the vertex $v$. (Indeed, for $k > 2$,
there is more than one possibility.)
\item We need to change the definition of ``enmity''.
\item We need to prove that the enmity cannot keep decreasing forever.
\end{enumerate}
I leave change 1 to the reader (the cases $k \leq 1$ are essentially
trivial).
As for change 2: We have some $v \in V$ such that more than
$p_{f\tup{v}} \deg v$ among the neighbors of $v$ have the same color
of $v$. Then, there exists \textbf{some} $i \in \set{1, 2, \ldots, k}$
such that \textbf{at most} $p_i \deg v$ among the neighbors of $v$
have the color $i$ (because otherwise, by summing over all $i$, we
conclude that $v$ has more than
$\sum_{i=1}^k p_i \deg v
= \underbrace{\tup{p_1+p_2+\ldots+p_k}}_{\geq 1} \deg v
\geq \deg v$ neighbors in total; but this is absurd)\footnote{You can
even find an $i$ such that \textbf{fewer than} $p_i \deg v$ among the
neighbors of $v$ have the color $i$. But that's not necessary for
us.}. Fix such an $i$,
and replace the color $f \tup{v}$ of $v$ by this $i$.
What about change 3? We formerly defined the enmity of a coloring $f$
to be the number of $f$-monochromatic edges. This definition no longer
works. However, what works is the following subtler definition: For
each $i \in \set{1, 2, \ldots, k}$, an edge $e$ of $G$ is said to be
\textit{$\tup{f, i}$-chromatic} if the two endpoints of $e$ both have
color $i$ in the $k$-coloring $f$. The \textit{enmity} of a
$k$-coloring $f$ is now defined as the sum
\[
\sum_{i=1}^k \dfrac{1}{p_i} \tup{ \text{the number of all }
\tup{f, i}\text{-chromatic edges} }.
\]
This definition requires a minor technical fix: It only works if all
$p_i$ are positive (i.e., nonzero). Fortunately, we can WLOG assume
that all $p_i$ are positive (indeed, if some $p_i$ is zero, then
we can discard this $p_i$, and correspondingly agree to never use the
color $i$ in our coloring). Proving that the enmity decreases
throughout the algorithm is rather easy (a straightforward
modification of the original argument).
Change 4 is simple but subtle; it is really easy to miss its
importance. In the solution of Exercise 1 on
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/hw0s.pdf}{homework set 0},
we just argued that the enmity of a $2$-coloring cannot keep
decreasing forever because it is a nonnegative integer. However, in
our more general setting, the enmity no longer is a nonnegative
integer, and thus one could imagine it decreasing indefinitely
(e.g., from $1$ to
$1/2$, then on to $1/3$, then on to $1/4$, etc.). So we need a new
argument. Fortunately, there is an easy one: There are only finitely
many $k$-colorings of $G$ (namely, $k^{\abs{V}}$ many). Hence, there
are only finitely many values that the enmity of a $k$-coloring of $G$
can take. Hence, the enmity cannot keep decreasing forever (because
that would force it to take infinitely many different values along
the way). So we are done.
\end{proof}
\begin{noncompile}
A \textit{forest} means a simple graph that has no cycles.
\begin{exercise} \label{exe.mt1.forests-matroid}
Let $G = \tup{V, E}$ be a forest. Let $H = \tup{V, F}$ be a forest
with the same vertex set as $G$ but satisfying $\abs{F} > \abs{E}$.
Prove that there exists some $f \in F \setminus E$ such that
$\tup{V, E \cup \set{f}}$ is still a forest. (In other words, prove
that we can add some edge from $H$ to the graph $G$ such that the
resulting graph is still a forest, but this edge was not contained in
$G$ to begin with.)
\end{exercise}
\end{noncompile}
\subsection{Exercise \ref{exe.mt1.euler-add}: adding edges to get an
Eulerian circuit}
\begin{exercise} \label{exe.mt1.euler-add}
Let $G$ be a connected multigraph. Let $m$ be the number of vertices
of $G$ that have odd degree. Prove that we can add $m/2$ new edges to
$G$ in such a way that the resulting multigraph will have an Eulerian
circuit. (It is allowed to add an edge even if there is already an
edge between the same two vertices.)
\end{exercise}
\begin{proof}[Hints to Exercise~\ref{exe.mt1.euler-add}.]
Proposition 2.5.8 in the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/nogra.pdf}{lecture notes}
says that the number of vertices of $G$ having odd degree is
even\footnote{To be fully precise, Proposition 2.5.8 in the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/nogra.pdf}{lecture notes}
only states this fact for simple graphs, not for multigraphs. But the
proof for multigraphs is almost the same. (The only difference is that
``$v \in e$'' must be replaced by ``$v \in \phi\tup{e}$''.)}.
In other words, $m$ is even. Let $v_1, v_2, \ldots, v_m$ be the $m$
vertices of $G$ that have odd degree.
Now, let us add $m/2$ new edges
$e_1, e_2, \ldots, e_{m/2}$ to $G$, where each $e_i$ has
$\phi\tup{e_i} = \set{v_{2i-1}, v_{2i}}$.
(This is well-defined, since $m$ is even.) The resulting multigraph is
clearly connected (since $G$ was connected), and has the property that
each of its vertices has even degree\footnote{\textit{Proof.}
Let us see how the degrees of the vertices of our multigraph have been
affected by adding the $m/2$ new edges $e_1, e_2, \ldots, e_{m/2}$:
\begin{itemize}
\item The degrees of the vertices $v_1, v_2, \ldots, v_m$ have been
incremented by $1$ when we added our $m/2$ new edges. This
caused these degrees to become even (because back in the
original multigraph $G$, they were odd).
\item The degrees of all other vertices have not changed when we added
our $m/2$ new edges (because none of these new edges contains
any of the other vertices). Hence, these degrees have remained
even (because they were even in the original multigraph $G$).
\end{itemize}
Thus, in the resulting multigraph, the degrees of \textbf{all}
vertices have become even.}.
Hence, by the Euler-Hierholzer theorem, this new graph has an Eulerian
circuit.
\end{proof}
\subsection{Exercise \ref{exe.mt1.d+d+d}: how large can the perimeter
of a triangle on a graph be?}
\subsubsection{Distances in a graph}
If $u$ and $v$ are two vertices of a simple graph $G$, then
$d \tup{u, v}$ denotes the \textit{distance} between $u$ and $v$. This
is defined to be the minimum length of a path from $u$ to $v$ if
such a path exists; otherwise it is defined to be the symbol $\infty$.
We observe the following simple facts:
\begin{lemma} \label{lem.mt1.d-leq-V}
Let $u$ and $v$ be two vertices of a connected simple graph
$G = \tup{V, E}$.
Then, $d \tup{u, v} \leq \abs{V} - 1$.
\end{lemma}
\begin{proof}[Proof of Lemma~\ref{lem.mt1.d-leq-V}.]
The simple graph $G$ is connected. Hence, there exists a walk from $u$
to $v$ in $G$. Let $k$ be the length of this walk. Therefore, there
exists a walk from $u$ to $v$ in $G$ having length $\leq k$ (namely,
the walk we have just constructed).
Hence, Corollary 2.8.10 in the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/nogra.pdf}{lecture notes}
shows that there exists a path from $u$ to $v$ having length
$\leq k$. Let $\tup{u_0, u_1, \ldots, u_g}$ be this path. Then, the
vertices $u_0, u_1, \ldots, u_g$ are pairwise distinct (since
$\tup{u_0, u_1, \ldots, u_g}$ is a path). Hence,
$\abs{\set{u_0, u_1, \ldots, u_g}} = g+1$. But from
$\set{u_0, u_1, \ldots, u_g} \subseteq V$, we obtain
$\abs{\set{u_0, u_1, \ldots, u_g}} \leq \abs{V}$. Thus,
$g + 1 = \abs{\set{u_0, u_1, \ldots, u_g}} \leq \abs{V}$.
Hence, $g \leq \abs{V} - 1$.
Now, there exists a path from $u$ to $v$ having length $g$ (namely,
the path $\tup{u_0, u_1, \ldots, u_g}$). Hence, the minimum length of
a path from $u$ to $v$ is $\leq g$. But this minimum length is
$d \tup{u, v}$ (by the definition of $d \tup{u, v}$). Hence, we obtain
$d \tup{u, v} \leq g \leq \abs{V} - 1$. This proves
Lemma~\ref{lem.mt1.d-leq-V}.
\end{proof}
Lemma~\ref{lem.mt1.d-leq-V} shows that if $u$ and $v$ are two
vertices of a connected simple graph $G$, then $d \tup{u, v}$ is an
actual integer (as opposed to $\infty$).
\begin{lemma} \label{lem.mt1.walk-to-distance}
Let $u$ and $v$ be two vertices of a simple graph $G$. Let
$k \in \NN$. If there exists a walk from $u$ to $v$ in $G$ having
length $k$, then $d \tup{u, v} \leq k$.
\end{lemma}
\begin{proof}[Proof of Lemma~\ref{lem.mt1.walk-to-distance}.]
We assumed that there exists a walk from $u$ to $v$ in $G$ having
length $k$. Therefore, Corollary 2.8.10 in the
\href{http://www.cip.ifi.lmu.de/~grinberg/t/17s/nogra.pdf}{lecture notes}
shows that there exists a path from $u$ to $v$ having length
$\leq k$. Therefore, the minimum length of a path from $u$ to $v$
is $\leq k$. But this minimum length is $d \tup{u, v}$ (by the
definition of $d \tup{u, v}$). Hence, we obtain
$d \tup{u, v} \leq k$. This proves
Lemma~\ref{lem.mt1.walk-to-distance}.
\end{proof}
\begin{lemma} \label{lem.mt1.distances-metric}
Let $G = \tup{V, E}$ be a simple graph.
\textbf{(a)} Each $u \in V$ satisfies $d \tup{u, u} = 0$.
\textbf{(b)} Each $u \in V$ and $v \in V$ satisfy
$d \tup{u, v} = d \tup{v, u}$.
\textbf{(c)} Each $u \in V$, $v \in V$ and $w \in V$ satisfy
$d \tup{u, v} + d \tup{v, w} \geq d \tup{u, w}$.
(This inequality has to be interpreted appropriately when one of the
distances is infinite: For example, we understand $\infty$ to be
greater than any integer, and we understand $\infty + m$ to be
$\infty$ whenever $m \in \ZZ$.)
\textbf{(d)} If $u \in V$ and $v \in V$ satisfy $d \tup{u, v} = 0$,
then $u = v$.
\end{lemma}
\begin{proof}[Proof of Lemma~\ref{lem.mt1.distances-metric}
(sketched).]
Parts \textbf{(a)}, \textbf{(b)} and \textbf{(d)} of
Lemma~\ref{lem.mt1.distances-metric} are easy to check, and thus left
to the reader.
\textbf{(c)} We WLOG assume that none of the two distances
$d \tup{u, v}$ and $d \tup{v, w}$ is $\infty$ (since otherwise,
Lemma~\ref{lem.mt1.distances-metric} \textbf{(c)} holds for obvious
reasons).
If there was no path from $u$ to $v$, then $d \tup{u, v}$ would be
$\infty$ (by the definition of $d \tup{u, v}$), which would contradict
the fact that none of the two distances
$d \tup{u, v}$ and $d \tup{v, w}$ is $\infty$. Hence, there must exist
at least one path from $u$ to $v$. Thus,
$d \tup{u, v}$ is the minimum length of a path from $u$ to $v$ (by the
definition of $d \tup{u, v}$). Hence, there exists a path from $u$ to
$v$ having length $d \tup{u, v}$. Fix such a path, and denote it by
$\mathbf{p} = \tup{p_0, p_1, \ldots, p_g}$. Hence,
$\tup{\text{the length of the path } \mathbf{p}} = g$. Therefore,
$g = \tup{\text{the length of the path } \mathbf{p}} = d \tup{u, v}$
(since $\mathbf{p}$ has length $d \tup{u, v}$).
We have shown that there exists a path from $u$ to
$v$ having length $d \tup{u, v}$. Similarly, we can show that there
exists a path from $v$ to $w$ having length $d \tup{v, w}$. Fix such
a path, and denote it by
$\mathbf{q} = \tup{q_0, q_1, \ldots, q_h}$. Hence,
$\tup{\text{the length of the path } \mathbf{q}} = h$. Therefore,
$h = \tup{\text{the length of the path } \mathbf{q}} = d \tup{v, w}$
(since $\mathbf{h}$ has length $d \tup{v, w}$).
Now, $\tup{p_0, p_1, \ldots, p_g}$ is a path from $u$ to $v$. Hence,
$p_0 = u$ and $p_g = v$.
Also, $\tup{q_0, q_1, \ldots, q_h}$ is a path from $v$ to $w$. Hence,
$q_0 = v$ and $q_h = w$.
The lists $\tup{p_0, p_1, \ldots, p_g}$ and
$\tup{q_0, q_1, \ldots, q_h}$ are paths, and therefore walks. The
ending point $p_g$ of the first of these two walks is the starting
point $q_0$ of the second (because $p_g = v = q_0$).
Hence, we can combine these two walks to a walk
$\tup{p_0, p_1, \ldots, p_g, q_1, q_2, \ldots, q_h}
= \tup{p_0, p_1, \ldots, p_{g-1}, q_0, q_1, \ldots, q_h}$. This latter
walk has length $g + h$, and is a walk from $u$ to $w$ (since
$p_0 = u$ and $q_h = w$). Thus, there exists a walk from $u$ to $w$
having length $g + h$ (namely, the walk that we have just
constructed). Hence,
Lemma~\ref{lem.mt1.walk-to-distance} (applied to $w$ and $g + h$
instead of $v$ and $k$) shows that $d \tup{u, w} \leq g + h
= d \tup{u, v} + d \tup{v, w}$ (since $g = d \tup{u, v}$ and
$h = d \tup{v, w}$). In other words,
$d \tup{u, v} + d \tup{v, w} \geq d \tup{u, w}$.
This proves Lemma~\ref{lem.mt1.distances-metric} \textbf{(c)}.
\end{proof}
Lemma~\ref{lem.mt1.distances-metric} \textbf{(c)} is known as the
\textit{triangle inequality} for distances on a graph.
Of course, this is due to its similarity to the well-known triangle
inequality in Euclidean geometry. In fact, this similarity goes
deeper:
Lemma~\ref{lem.mt1.d-leq-V} shows that if $G = \tup{V, E}$ is a
connected simple graph, then the definition of the distance
$d \tup{u, v}$ for each pair $\tup{u, v} \in V \times V$ gives rise
to a well-defined map $d : V \times V \to \NN$.
Lemma~\ref{lem.mt1.distances-metric} shows that this map $d$ is a
\href{https://en.wikipedia.org/wiki/Metric_(mathematics)}{metric}.
We shall not use this in the following, but it is a useful fact to
keep in one's mind.
\subsubsection{Statement of the exercise}
\begin{exercise} \label{exe.mt1.d+d+d}
Let $a$, $b$ and $c$ be three vertices of a connected simple graph
$G = \tup{V, E}$.
Prove that
$d \tup{b, c} + d \tup{c, a} + d \tup{a, b} \leq 2 \abs{V} - 2$.
\end{exercise}
\subsubsection{First solution}
\begin{proof}[Solution sketch to Exercise~\ref{exe.mt1.d+d+d}.]
The following solution was found by Jiali Huang and
Nicholas Rancourt.
Fix some path $\mathbf{z} = \tup{z_0, z_1, \ldots, z_g}$ from
$a$ to $b$ having minimum length. Then, the length of $\mathbf{z}$ is
$d \tup{a, b}$ (since $d \tup{a, b}$ is defined as the minimum
length of a path from $a$ to $b$). Hence,
\begin{equation}
d \tup{a, b}
= \tup{\text{the length of the path } \mathbf{z}}
= g
\label{pf.exe.mt1.d+d+d.walk0}
\end{equation}
(since $\mathbf{z} = \tup{z_0, z_1, \ldots, z_g}$).
Since $\tup{z_0, z_1, \ldots, z_g}$ is a path from $a$ to $b$,
we have $z_0 = a$ and $z_g = b$.
Since $\tup{z_0, z_1, \ldots, z_g}$ is a path, the $g+1$
vertices $z_0, z_1, \ldots, z_g$ are distinct. Hence,
$\abs{\set{z_0, z_1, \ldots, z_g}} = g+1$.
Now, pick an element $i \in \set{0, 1, \ldots, g}$ for which the
number $d \tup{c, z_i}$ is minimum. Hence,
\begin{equation}
d \tup{c, z_i} \leq d \tup{c, z_j}
\qquad \text{for each } j \in \set{0, 1, \ldots, g} .
\label{sol.mt1.d+d+d.zi-minimum}
\end{equation}
Fix some path $\mathbf{t} = \tup{t_0, t_1, \ldots, t_h}$ from
$c$ to $z_i$ having minimum length. Then, the length of $\mathbf{t}$
is $d \tup{c, z_i}$ (since $d \tup{c, z_i}$ is defined as the
minimum length of a path from $c$ to $z_i$). Hence,
\[
d \tup{c, z_i}
= \tup{\text{the length of the path } \mathbf{t}}
= h
\]
(since $\mathbf{t} = \tup{t_0, t_1, \ldots, t_h}$).
Since $\tup{t_0, t_1, \ldots, t_h}$ is a path from $c$ to $z_i$,
we have $t_0 = c$ and $t_h = z_i$.
Since $\tup{t_0, t_1, \ldots, t_h}$ is a path, the $h+1$
vertices $t_0, t_1, \ldots, t_h$ are distinct. In particular,
the $h$ vertices $t_0, t_1, \ldots, t_{h-1}$ are distinct. Hence,
$\abs{\set{t_0, t_1, \ldots, t_{h-1}}} = h$.
Now, there is a walk from $c$ to $a$ in $G$ having length
$h + i$\ \ \ \ \footnote{\textit{Proof.} We know that
$\tup{z_0, z_1, \ldots, z_g}$ is a path, thus a walk. Hence,
$\tup{z_0, z_1, \ldots, z_i}$ is a walk as well. Therefore,
$\tup{z_i, z_{i-1}, \ldots, z_0}$ is a walk (being the reversal
of the walk $\tup{z_0, z_1, \ldots, z_i}$). On the other hand,
$\tup{t_0, t_1, \ldots, t_h}$ is a walk.
Since the ending point of the walk $\tup{t_0, t_1, \ldots, t_h}$
is the starting point of the walk
$\tup{z_i, z_{i-1}, \ldots, z_0}$ (because $t_h = z_i$), we can
combine these two walks, obtaining a new walk
$\tup{t_0, t_1, \ldots, t_{h-1}, z_i, z_{i-1}, \ldots, z_0}$.
This new walk is a walk from $c$ to $a$ (since $t_0 = c$ and
$z_0 = a$) and has length $h + i$. Hence, there is a
walk from $c$ to $a$ in $G$ having length $h + i$ (namely, the
walk that we have just constructed).}. Hence,
Lemma~\ref{lem.mt1.walk-to-distance} (applied to $u = c$, $v = a$
and $k = h + i$) shows that
\begin{equation}
d \tup{c, a} \leq h + i .
\label{pf.exe.mt1.d+d+d.walk1}
\end{equation}
On the other hand, there is a walk from $b$ to $c$ in $G$ having
length $\tup{g-i} + h$\ \ \ \ \footnote{\textit{Proof.} We know that
$\tup{z_0, z_1, \ldots, z_g}$ is a path, thus a walk. Hence,
$\tup{z_i, z_{i+1}, \ldots, z_g}$ is a walk as well. Therefore,
$\tup{z_g, z_{g-1}, \ldots, z_i}$ is a walk (being the reversal
of the walk $\tup{z_i, z_{i+1}, \ldots, z_g}$). On the other hand,
$\tup{t_0, t_1, \ldots, t_h}$ is a walk. Hence,
$\tup{t_h, t_{h-1}, \ldots, t_0}$ is a walk as well
(being the reversal of the walk $\tup{t_0, t_1, \ldots, t_h}$).
Since the ending point of the walk $\tup{z_g, z_{g-1}, \ldots, z_i}$
is the starting point of the walk
$\tup{t_h, t_{h-1}, \ldots, t_0}$ (because $z_i = t_h$), we can
combine these two walks, obtaining a new walk
$\tup{z_g, z_{g-1}, \ldots, z_i, t_{h-1}, t_{h-2}, \ldots, t_0}$.
This new walk is a walk from $b$ to $c$ (since $z_g = b$ and
$t_0 = c$) and has length $\tup{g-i} + h$. Hence, there is a
walk from $b$ to $c$ in $G$ having length $\tup{g-i} + h$ (namely,
the walk that we have just constructed).}. Hence,
Lemma~\ref{lem.mt1.walk-to-distance} (applied to $u = b$, $v = c$
and $k = \tup{g-i} + h$) shows that
\begin{equation}
d \tup{b, c} \leq \tup{g-i} + h .
\label{pf.exe.mt1.d+d+d.walk2}
\end{equation}
It is easy to see that the sets
$\set{t_0, t_1, \ldots, t_{h-1}}$ and
$\set{z_0, z_1, \ldots, z_g}$ are disjoint\footnote{\textit{Proof.}
Let $v \in
\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}$.
We shall derive a contradiction.
We have
$v \in
\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}
\subseteq \set{t_0, t_1, \ldots, t_{h-1}}$. Hence,
$v = t_p$ for some $p \in \set{0, 1, \ldots, h-1}$. Consider this
$p$.
We have $v \in
\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}
\subseteq \set{z_0, z_1, \ldots, z_g}$. Hence,
$v = z_j$ for some $j \in \set{0, 1, \ldots, g}$. Consider this
$j$.
Recall that $\tup{t_0, t_1, \ldots, t_h}$ is a walk. Hence,
$\tup{t_0, t_1, \ldots, t_p}$ is a walk as well. This walk
$\tup{t_0, t_1, \ldots, t_p}$ is a walk from $c$ to $v$ (since
$t_0 = c$ and $t_p = v$) and has length $p$.
Hence, there is a walk from $c$ to $v$ in $G$ having length
$p$ (namely, the walk $\tup{t_0, t_1, \ldots, t_p}$).
Consequently, Lemma~\ref{lem.mt1.walk-to-distance}
(applied to $u = c$ and $k = p$) shows that
$d \tup{c, v} \leq p \leq h-1$
(since $p \in \set{0, 1, \ldots, h-1}$).
But \eqref{sol.mt1.d+d+d.zi-minimum} yields
$d \tup{c, z_i} \leq d \tup{c, z_j} = d \tup{c, v}$
(since $z_j = v$). Thus, $d \tup{c, v} \geq d \tup{c, z_i}
= h > h-1$. This contradicts $d \tup{c, v} \leq h-1$.
Now, forget that we fixed $v$. Thus, we have obtained a
contradiction for each
$v \in
\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}$.
Hence, there exists no
$v \in
\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}$.
Thus,
$\set{t_0, t_1, \ldots, t_{h-1}} \cap \set{z_0, z_1, \ldots, z_g}
= \varnothing$. In other words, the sets
$\set{t_0, t_1, \ldots, t_{h-1}}$ and
$\set{z_0, z_1, \ldots, z_g}$ are disjoint.}. Hence, the sum of
the sizes of these sets equals the size of their union. In other
words,
\begin{align*}
\abs{\set{t_0, t_1, \ldots, t_{h-1}}}
+ \abs{\set{z_0, z_1, \ldots, z_g}}
&=
\abs{\underbrace{\set{t_0, t_1, \ldots, t_{h-1}} \cup
\set{z_0, z_1, \ldots, z_g}}_{\subseteq V}}
\leq \abs{V} .
\end{align*}
Since $\abs{\set{z_0, z_1, \ldots, z_g}} = g+1$
and $\abs{\set{t_0, t_1, \ldots, t_{h-1}}} = h$, this rewrites as
$h + \tup{g+1} \leq \abs{V}$. Hence,
$\tup{g+h} + 1 = h + \tup{g+1} \leq \abs{V}$, so that
$g+h \leq \abs{V} - 1$.
Adding together the two inequalities \eqref{pf.exe.mt1.d+d+d.walk2}
and \eqref{pf.exe.mt1.d+d+d.walk1} and the equation
\eqref{pf.exe.mt1.d+d+d.walk0}, we obtain
\begin{align*}
d \tup{b, c} + d \tup{c, a} + d \tup{a, b}
&\leq \tup{\tup{g-i} + h} + \tup{h + i} + g
= 2 \tup{\underbrace{g+h}_{\leq \abs{V} - 1}} \\
&\leq 2 \tup{\abs{V} - 1} = 2 \abs{V} - 2 .
\end{align*}
This solves the exercise.
\end{proof}
\subsubsection{Second solution}
\begin{proof}[Hints to a second solution of Exercise~\ref{exe.mt1.d+d+d}.]
The following solution is how I originally solved the exercise.
Let $\ell\tup{\mathbf{w}}$ denote the length of a walk $\mathbf{w}$.
Fix
\begin{itemize}
\item a shortest path $\mathbf{x}$ from $b$ to $c$;
\item a shortest path $\mathbf{y}$ from $c$ to $a$.
\item a shortest path $\mathbf{z}$ from $a$ to $b$.
\end{itemize}
Let $X$ be the set of all vertices of $\mathbf{x}$. Similarly define
$Y$ and $Z$. Thus,
\begin{align}
d \tup{b, c} &= \ell\tup{\mathbf{x}} = \abs{X} - 1 \qquad \text{and}
\label{pf.exe.mt1.d+d+d.hint.d1} \\
d \tup{c, a} &= \ell\tup{\mathbf{y}} = \abs{Y} - 1 \qquad \text{and}
\label{pf.exe.mt1.d+d+d.hint.d2} \\
d \tup{a, b} &= \ell\tup{\mathbf{z}} = \abs{Z} - 1.
\label{pf.exe.mt1.d+d+d.hint.d3}
\end{align}
Now, we claim that $\abs{X \cap Y \cap Z} \leq 1$. Indeed, assume the
contrary. Then, $\abs{X \cap Y \cap Z} \geq 2$. Hence, there exist two
distinct vertices $p$ and $q$ in $X \cap Y \cap Z$. Consider these $p$
and $q$.
Both vertices $p$ and $q$ belong to $X \cap Y \cap Z \subseteq X$,
thus appear on the path $\mathbf{x}$.
We WLOG assume that $p$ appears before $q$ on this path (i.e., the
path $\mathbf{x}$ has the form
$\tup{\ldots, p, \ldots, q, \ldots}$, where some of the $\ldots$ may
be empty). (This WLOG assumption is legitimate, since we can switch
$p$ with $q$.)
But the vertices $p$ and $q$ also appear on the path $\mathbf{y}$
(since they belong to $X \cap Y \cap Z \subseteq Y$). The vertex $p$
must appear after $q$ on this path\footnote{\textit{Proof.} Assume
the contrary. Thus, $p$ appears before $q$ on the path $\mathbf{y}$.
Now, let us split the path $\mathbf{x}$ into three parts: Namely,
\begin{itemize}
\item let $\mathbf{x}_1$ be the part between $b$ and $p$;
\item let $\mathbf{x}_2$ be the part between $p$ and $q$;
\item let $\mathbf{x}_3$ be the part between $q$ and $c$.
\end{itemize}
(This is possible because $p$ appears before $q$ in $\mathbf{x}$.)
Then, $\ell\tup{\mathbf{x}} = \ell\tup{\mathbf{x}_1}
+ \ell\tup{\mathbf{x}_2} + \ell\tup{\mathbf{x}_3}$.
Next, let us split the path $\mathbf{y}$ into three parts: Namely,
\begin{itemize}
\item let $\mathbf{y}_1$ be the part between $c$ and $p$;
\item let $\mathbf{y}_2$ be the part between $p$ and $q$;
\item let $\mathbf{y}_3$ be the part between $q$ and $a$.
\end{itemize}
(This is possible because $p$ appears before $q$ in $\mathbf{y}$.)
Then, $\ell\tup{\mathbf{y}} = \ell\tup{\mathbf{y}_1}
+ \ell\tup{\mathbf{y}_2} + \ell\tup{\mathbf{y}_3}$.
The path $\mathbf{x}_2$ connects $p$ and $q$, and thus has length $>0$
(since $p$ and $q$ are distinct). Hence, $\ell\tup{\mathbf{x}_2} > 0$.
Thus,
\[
\ell\tup{\mathbf{x}}
= \ell\tup{\mathbf{x}_1}
+ \underbrace{\ell\tup{\mathbf{x}_2}}_{> 0}
+ \ell\tup{\mathbf{x}_3}
> \ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{x}_3} ,
\]
so that
\begin{align}
\ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{x}_3}
< \ell\tup{\mathbf{x}} = d \tup{b, c} .
\label{pf.exe.mt1.d+d+d.hint.fn1.more1}
\end{align}
Similarly,
\begin{align}
\ell\tup{\mathbf{y}_1} + \ell\tup{\mathbf{y}_3}
< d \tup{c, a} .
\label{pf.exe.mt1.d+d+d.hint.fn1.more2}
\end{align}
Combining the reversal of the walk $\mathbf{x}_3$ with the walk
$\mathbf{y}_3$, we obtain a walk from $c$ to $a$ (via $q$). This walk
has length $\ell\tup{\mathbf{x}_3} + \ell\tup{\mathbf{y}_3}$. Hence,
there exists a walk from $c$ to $a$ having length
$\ell\tup{\mathbf{x}_3} + \ell\tup{\mathbf{y}_3}$. Consequently,
Lemma~\ref{lem.mt1.walk-to-distance} (applied to $u = c$, $v = a$
and $k = \ell\tup{\mathbf{x}_3} + \ell\tup{\mathbf{y}_3}$) shows that
\begin{equation}
d \tup{c, a} \leq \ell\tup{\mathbf{x}_3} + \ell\tup{\mathbf{y}_3} .
\label{pf.exe.mt1.d+d+d.hint.fn1.1}
\end{equation}
Combining the walk $\mathbf{x}_1$ with the reversal of the walk
$\mathbf{y}_1$, we obtain a walk from $b$ to $c$ (via $p$). This walk
has length $\ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{y}_1}$. Hence,
there exists a walk from $b$ to $c$ having length
$\ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{y}_1}$. Consequently,
Lemma~\ref{lem.mt1.walk-to-distance} (applied to $u = b$, $v = c$
and $k = \ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{y}_1}$) shows that
\begin{equation}
d \tup{b, c} \leq \ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{y}_1} .
\label{pf.exe.mt1.d+d+d.hint.fn1.2}
\end{equation}
Adding together the inequalities \eqref{pf.exe.mt1.d+d+d.hint.fn1.1}
and \eqref{pf.exe.mt1.d+d+d.hint.fn1.2}, we obtain
\begin{align*}
d \tup{c, a} + d \tup{b, c}
&\leq \tup{\ell\tup{\mathbf{x}_3} + \ell\tup{\mathbf{y}_3}}
+ \tup{\ell\tup{\mathbf{x}_1} + \ell\tup{\mathbf{y}_1}} \\
&=
\underbrace{ \ell\tup{\mathbf{y}_1}
+ \ell\tup{\mathbf{y}_3} }
_{\substack{< d\tup{c, a} \\
\text{(by \eqref{pf.exe.mt1.d+d+d.hint.fn1.more2})}}}
+ \underbrace{ \ell\tup{\mathbf{x}_1}
+ \ell\tup{\mathbf{x}_3} }
_{\substack{< d\tup{b, c} \\
\text{(by \eqref{pf.exe.mt1.d+d+d.hint.fn1.more1})}}}
< d \tup{c, a} + d \tup{b, c}.
\end{align*}
This is absurd. Hence, we have found a contradiction, qed.}.
In other words, the vertex $q$ appears before $p$ on the path
$\mathbf{y}$.
The same reasoning (but applied to $b$, $c$, $a$, $\mathbf{y}$,
$\mathbf{z}$, $\mathbf{x}$, $q$ and $p$ instead of $a$, $b$, $c$,
$\mathbf{x}$, $\mathbf{y}$, $\mathbf{z}$, $p$ and $q$) now shows that
the vertex $p$ appears before $q$ on the path $\mathbf{z}$ (because
the vertex $q$ appears before $p$ on the path $\mathbf{y}$). The same
reasoning (but applied to $b$, $c$, $a$, $\mathbf{y}$,
$\mathbf{z}$ and $\mathbf{x}$ instead of $a$, $b$, $c$,
$\mathbf{x}$, $\mathbf{y}$ and $\mathbf{z}$) therefore shows
that the vertex $p$ appears before $q$ on the path $\mathbf{y}$. But
this contradicts the fact that the vertex $q$ appears before $p$ on
the path $\mathbf{y}$.
This contradiction shows that our assumption was wrong. Hence,
$\abs{X \cap Y \cap Z} \leq 1$ is proven. From this, we can easily
obtain $\abs{X} + \abs{Y} + \abs{Z} \leq 2 \abs{X \cup Y \cup Z} + 1$
\ \ \ \ \footnote{\textit{Proof.} The sum
$\abs{X} + \abs{Y} + \abs{Z}$ counts the elements of
$X \cup Y \cup Z$, but it counts some of them twice and some thrice:
Namely, an element is counted thrice if it belongs to
$X \cap Y \cap Z$; otherwise, it is counted at most twice. Since
$\abs{X \cap Y \cap Z} \leq 1$, we know that at most one element is
counted thrice. All other elements are counted at most twice. Hence,
the total sum $\abs{X} + \abs{Y} + \abs{Z}$ is at most
$3 + 2 \tup{\abs{X \cup Y \cup Z} - 1} = 2 \abs{X \cup Y \cup Z} + 1$.
Qed.}. Now, adding the equalities
\eqref{pf.exe.mt1.d+d+d.hint.d1}, \eqref{pf.exe.mt1.d+d+d.hint.d2}
and \eqref{pf.exe.mt1.d+d+d.hint.d3} together, we obtain
\begin{align*}