<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de-AT">
	<id>https://mediawiki.fernfh.ac.at/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SAFFER+Zsolt</id>
	<title>FernFH MediaWiki - Benutzerbeiträge [de-at]</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.fernfh.ac.at/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SAFFER+Zsolt"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php/Spezial:Beitr%C3%A4ge/SAFFER_Zsolt"/>
	<updated>2026-05-20T08:52:28Z</updated>
	<subtitle>Benutzerbeiträge</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6562</id>
		<title>Informatik und IT</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6562"/>
		<updated>2025-03-29T19:20:02Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Introduction_to_Computational_and_Artificial_Intelligence|Introduction to Computational and Artificial Intelligence]]&lt;br /&gt;
&lt;br /&gt;
[[Webserver Infrastructures|Webserver Infrastructures]]&lt;br /&gt;
&lt;br /&gt;
[[Cloud Computing Security|Cloud Computing Security]]&lt;br /&gt;
&lt;br /&gt;
[[KI in der Wirtschaft|KI in der Wirtschaft]]&lt;br /&gt;
&lt;br /&gt;
[[AI assisted Engineering|AI assisted Engineering]]&lt;br /&gt;
&lt;br /&gt;
[[Numerische_Methoden_und_Performance_Computing|Numerische Methoden und Performance Computing]]&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6561</id>
		<title>Informatik und IT</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6561"/>
		<updated>2025-03-29T19:19:14Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Introduction_to_Computational_and_Artificial_Intelligence|Introduction_to_Computational_and_Artificial_Intelligence]]&lt;br /&gt;
&lt;br /&gt;
[[Webserver Infrastructures|Webserver Infrastructures]]&lt;br /&gt;
&lt;br /&gt;
[[Cloud Computing Security|Cloud Computing Security]]&lt;br /&gt;
&lt;br /&gt;
[[KI in der Wirtschaft|KI in der Wirtschaft]]&lt;br /&gt;
&lt;br /&gt;
[[AI assisted Engineering|AI assisted Engineering]]&lt;br /&gt;
&lt;br /&gt;
[[Numerische_Methoden_und_Performance_Computing|Numerische Methoden und Performance Computing]]&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=References&amp;diff=6554</id>
		<title>References</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=References&amp;diff=6554"/>
		<updated>2025-03-13T21:22:57Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;thebibliography&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Hardy and Wright(1975)] G. H. Hardy and Edward M. Wright. &amp;#039;&amp;#039;Theory of Numbers&amp;#039;&amp;#039;. Oxford University Press, Forth Edition, 1975.&lt;br /&gt;
&lt;br /&gt;
[Lang(1987)] Serge Lang. &amp;#039;&amp;#039;Linear ALgebra&amp;#039;&amp;#039;. Springer, Third Edition, 1987.&lt;br /&gt;
&lt;br /&gt;
[Gross and Yellen(1998)] Jonathan L. Gross and Jay Yellen. &amp;#039;&amp;#039;Graph Theory and Its Applications&amp;#039;&amp;#039;. Second Edition, Taylor &amp;amp;amp; Francis, 1998.&lt;br /&gt;
&lt;br /&gt;
[Labbé et al.(2004)] Martine Labbé, Gilbert Laporte, Martín Inmaculada Rodríguez, González, Juan José Salazar. . &amp;#039;&amp;#039;Networks.&amp;#039;&amp;#039;, 43 (3): 177–189, 2004. doi:10.1002/net.10114. ISSN 0028-3045&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6553</id>
		<title>Metrics in Data Science</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6553"/>
		<updated>2025-03-13T21:14:17Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;metrics-in-data-science&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Metrics in Data Science  =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-classification&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for classification ==&lt;br /&gt;
&lt;br /&gt;
A classification model is evaluated on the test data. The common metrics used to evaluate the model are listed as&lt;br /&gt;
&lt;br /&gt;
* Accuracy,&lt;br /&gt;
* Confusion matrix,&lt;br /&gt;
* Precision and Recall,&lt;br /&gt;
* Sensitivity and Specificity,&lt;br /&gt;
* F1Score and weighted F1,&lt;br /&gt;
* ROC curve and AUC ROC.&lt;br /&gt;
&lt;br /&gt;
Accuracy is the ratio of correctly classified examples to the total number of examples in the test set. Defining true examples (TE) and false examples (FE) the number of correctly and incorrectly classified examples in the test set, accuracy can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TE}{TE+FE}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The confusion matrix is a metric to visualize the classification performance. The rows of the matrix represent the true classes and the columns shows the predicted classes or vice versa. Both versions are used and can be found in the literature. Here we use the first version. The element (i,j) of the matrix shows the number of test examples belonging to class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and classified as class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;. Thus besides showing the number of correctly classified examples for each class, the confusion matrix gives an idea of typical missclassifications the model makes. An example confusion matrix can be seen in Figure [[#fig:exa_conf_matrix|16]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_conf_matrix&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:EvalMetric_ConfMatrExa.jpg|460px|thumb|center|Figure 16: An example confusion matrix for a classification model with 3 classes]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 were originally introduced for binary classification models, but their usage can be extended to multiclass case. Therefore they will be defined and explained first for binary classification model.&lt;br /&gt;
&lt;br /&gt;
In terms of binary classification with positive and negative classes, the outcome of the classification task can fall in one of four cases: correctly/incorrectly classified examples belonging to positive/negative class. The prediction is true positive (TP) when a positive example is correctly classified, like e.g. presence of a disease. A false negative (FN) prediction occurs when a positive example is classified by the model as would belong to negative class. Similarly a true negative (TN) prediction occurs when a negative example is correctly classified. Finally the prediction is false positive (FP) when a negative example is classified as would belong to positive class. These cases are summarized in Table [[#tab:poss_predictions|8]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:poss_predictions&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Possible cases of the outcome of the classification task (=prediction)&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| predicted &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\backslash&amp;lt;/math&amp;gt; true  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   positive  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| positive  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true positive (TP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false positive (FP)&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| negative  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false negative (FN)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true negative (TN)&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For the case of binary classification the definition of Accuracy can be given alternatively as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TP+TN}{TP+TN+FP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The terms TP, FN, TN and FP are also used to denote the number of corresponding cases, e.g. TP also denotes the number of true positives.&lt;br /&gt;
&lt;br /&gt;
Precision is the ratio of the correctly classified positive examples to the total number of examples classified as positive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Precision} = \frac{TP}{TP+FP}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In contrast to that Recall is the ratio of the correctly classified positive examples to the total number of positive examples: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Recall} = \frac{TP}{TP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The measures sensitivity and specificity are also commonly used, especially in the healthcare.&lt;br /&gt;
&lt;br /&gt;
Sensitivity is the True Positive Rate (TPR), i.e. the proportion of captured trues and hence it equals to recall. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Sensitivity} = \mathrm{TPR} = \frac{TP}{TP+FN}  = \mathrm{Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specificity is the proportion of the captured negatives, i.e. True Negative Rate (TNR). &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Specificity} = \frac{TN}{TN+FP}.&amp;lt;/math&amp;gt; It follows that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt; is the False Positive Rate (FPR), i.e. proportion of not captured negatives, which is needed to define the ROC curve (see below).&lt;br /&gt;
&lt;br /&gt;
The F1Score is a harmonic mean of precision and recall and therefore it is a number between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{F1Score} =  F_1  = 2*\frac{Precision*Recall}{Precision+Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:use_metrics&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ The usage of the different metrics.&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Metric  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   When to use ?  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Accuracy  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   In case of classification problem&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with balanced classes.  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Precision  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to be sure about the&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   positive prediction to avoid any negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   consequences, like e.g in case of decrease&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   of credit limit to avoid customer dissatisfaction.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Recall  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to capture positive even&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with low probability, like e.g. to predict&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   whether a person has illness or not.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Sensitivity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TPR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured positives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Specificity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TNR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured negatives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| F1Score  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When both Precision and Recall are important.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| weighted F1 metric  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When importance of Precision and Recall&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   against each other can be characterized&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   by weights explicitly .&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| ROC curve  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used for determining probability threshold&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   for deciding the output class of the task,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   see Figure x.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| AUC ROC  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used to determine how well the positive class&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   is separated from the negative class.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The weighted F1 metric is a refined version of F1Score, in which Precision and Recall can have different weights. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{ weighted F1} = F_{\beta} = (1+ \beta^2)*\frac{Precision*Recall}{\beta^2 *Precision+Recall},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where Recall has weight &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta^2&amp;lt;/math&amp;gt; is the weight of Precision.&lt;br /&gt;
&lt;br /&gt;
In a multi-class setting the metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 metric are calculated first for each class individually and then averaged. This way they quantify the overall classification performance.&lt;br /&gt;
&lt;br /&gt;
The metrics ROC curve and AUC ROC are defined for binary classification task. The Receiver Operating Characteristic (ROC) curve is the True Positive Rate (=Sensitivity) as a function of the False Positive Rate (= &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt;). The Area Under Curve ROC is called AUC ROC. It indicates how well the positive class is separated from the negative class.&lt;br /&gt;
&lt;br /&gt;
The usage of the different metrics are summarized in the Table [[#tab:use_metrics|9]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:ill_ROC_curve&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:ROC_curve.jpg|460px|thumb|center|Figure 17: Illustrating the determination of probability threshold on ROC curve (Source:\url{https://www.kdnuggets.com/2019/10/5-classification-evaluation-metrics-every-data-scientist-must-know.html}]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Depending on the use case strict, optimal or lenient (= moderate or high) probability threshold can be selected on the ROC curve. This is illustrated in Figure [[#fig:ill_ROC_curve|17]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-regression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for regression ==&lt;br /&gt;
&lt;br /&gt;
The common metrics used for evaluating regression models are are listed here.&lt;br /&gt;
&lt;br /&gt;
* Mean Squared Error (MSE),&lt;br /&gt;
* Root Mean Squared Error (RMSE)&lt;br /&gt;
* Mean Absolute Error (MAE),&lt;br /&gt;
* Mean Absolute Percentage Error (MAPE),&lt;br /&gt;
* Coefficient of Determination (COD), R-squared (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt;),&lt;br /&gt;
* modified R-squared,&lt;br /&gt;
&lt;br /&gt;
The Mean Squared Error (MSE) is one of the basic statistic used to evaluate the quality of a regression model. It is the average of the squares of the difference between the real and predicted values, in other words:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MSE} = \frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2.&amp;lt;/math&amp;gt; Less the MSE, better the regression model fits the real values.&lt;br /&gt;
&lt;br /&gt;
A similar measure is the Root Mean Squared Error (RMSE), which is the square root of MSE and thus it is biven as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{RMSE} = \sqrt{\frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2}.&amp;lt;/math&amp;gt; RMSE is a measure in the same units as the considered variable, which makes it a commonly used measure.&lt;br /&gt;
&lt;br /&gt;
The Mean Absolute Error (MAE) is the average absolute difference between the real and predicted values. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAE} = \frac{1}{K}\sum_{k}|y_k - \hat{y}_k|&amp;lt;/math&amp;gt; A nice property of MAE, that it is less likely influenced by extreme values. It is a common measure used in time series analysis as forecast error.&lt;br /&gt;
&lt;br /&gt;
The mean absolute percentage error (MAPE) quantifies the average of the ratio of the average absolute difference between the real and predicted values to the real value as a percentage. Hence the formula of MAPE can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAPE} = 100 \frac{1}{K}\sum_{k}|\frac{y_k - \hat{y}_k}{y_k}|&amp;lt;/math&amp;gt; MAPE is is commonly used for evaluating regression models and it is an appropriate metric where the scale of the considered value varies in a broad range. Intuitively it can be interpreted as a kind of relative error. This makes it also suitable to be used as a loss function as an objective in the optimization in regression problems.&lt;br /&gt;
&lt;br /&gt;
The metric Coefficient of Determination (COD) is also referred as R-squared and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r^2&amp;lt;/math&amp;gt; and pronounced as &amp;amp;quot;R-squared&amp;amp;quot;. The coefficient of determination determines the predictable proportion of the variation in the dependent variable, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{y}&amp;lt;/math&amp;gt; denote the mean of the output values, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{y} = \frac{1}{K} \sum_{k} y_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coefficient of determination is defined in terms of residual sum of squares, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{res}}&amp;lt;/math&amp;gt; and total sum of squares (related to the variance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{tot}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    SS_{\mathrm{res}} &amp;amp;= \sum_{k} ( y_k - \hat{y}_k)^2, \\&lt;br /&gt;
    SS_{\mathrm{tot}} &amp;amp;= \sum_{k} ( y_k - \bar{y}_k)^2&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}.&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; as metric quantifies the predictable proportion of the variation in the dependent variable. Its value falls between 0 and 1 with greater values indicating better regression fit.&lt;br /&gt;
&lt;br /&gt;
The metric modified (or adjusted) R-squared is introduced to compensate that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; increases when the dimension &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; becomes higher. Denoting the dimension of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;, the modified R-squared, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{R}^2&amp;lt;/math&amp;gt; is defined as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{R}^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}\frac{K-1}{K-N-1} = 1 -(1-R^2)\frac{K-1}{K-N-1}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metricS for KG ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quality-of-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Quality of KG ===&lt;br /&gt;
&lt;br /&gt;
The two most important quality measures of a KG are&lt;br /&gt;
&lt;br /&gt;
* completeness and&lt;br /&gt;
* accuracy.&lt;br /&gt;
&lt;br /&gt;
The completeness refers to evaluate the amount of existing triplets in the KG, while accuracy targets to measure the amounts of correct and incorrect triplets in the KG. After KG completion the resulted extraction graph is considered to be not yet a ready KG. Therefore quality measurement of KG is relevant only after KG refinement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-kg-refinement&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for KG refinement ===&lt;br /&gt;
&lt;br /&gt;
Usually completeness is measured in recall, precision and F-measure.&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, i.e. the amounts of correct and incorrect triplets is evaluated in terms of accuracy and alternatively, or in addition by means of AUC (i.e. the area under the ROC curve).&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; can be also based on the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt;, which can be assigned by human e.g. based on random sampling. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mu(\mathcal{G}) = \frac{1}{|\mathcal{T}|} \sum_{t \in \mathcal{T}} \mathbf{1}_{\{t\}},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{1}_{\{t\}}&amp;lt;/math&amp;gt; is the indicator variable indicating the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; otherwise taking the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In case of human judging, the usual evaluation metric is accuracy or precision together with the total number of judged triplets and errors found.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-link-prediction-with-kg-embeddings&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for link prediction with KG embeddings ===&lt;br /&gt;
&lt;br /&gt;
The used evaluation metric for link prediction with KG embeddings depends on the subtask of link prediction, see in Table [[#tab:Eval_metr_subt_LP|10]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:Eval_metr_subt_LP&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Evaluation metric for subtasks of link prediction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Subtask&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Evaluation metrics&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   rank based measures&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity type prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Macro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt; and Micro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Triple classification  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   accuracy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The rank based evaluation metrics for entity prediction include&lt;br /&gt;
&lt;br /&gt;
* Mean Reciprocal Rank (MRR) and&lt;br /&gt;
* Hits@K.&lt;br /&gt;
&lt;br /&gt;
Mean reciprocal rank is the average of the reciprocal ranks of the correct entities: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;MRR = \frac{1}{|\mathcal{Q}_c|}\sum_{q \in \mathcal{Q}_c} \frac{1}{R(q)},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{Q}_c&amp;lt;/math&amp;gt; is set of correct entries and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(q)&amp;lt;/math&amp;gt; is the rank of the entry q. Larger the MRR, better the entity prediction and hence also the used KG embedding model.&lt;br /&gt;
&lt;br /&gt;
Hits@k is the proportion of the correct entities in the best k predictions:&amp;lt;br /&amp;gt;&lt;br /&gt;
Hits@k&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;= \frac{|q \in \mathcal{Q}_c|: R(q) &amp;lt; k}{|\mathcal{Q}_c|}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Larger the Hits@k better the entity prediction and hence also the used KG embedding model.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6552</id>
		<title>Logic</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6552"/>
		<updated>2025-03-13T21:12:12Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical conjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Language_first_order_logic_BNF_gramma.jpg|460px|thumb|center|Figure 15: Language of syntactically valid first order logic formulas as context-free grammar in BNF]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6551</id>
		<title>Logic</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6551"/>
		<updated>2025-03-13T21:11:09Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical conjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Language_first_order_logic_BNF_gramma.jpg|460px|thumb|center|Figure 15: Language of syntactically valid first order logic formulas as context-free grammar in BNF}]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6550</id>
		<title>Logic</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6550"/>
		<updated>2025-03-13T21:09:33Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Language_first_order_logic_BNF_gramma.jpg|460px|thumb|center|Figure 15: Language of syntactically valid first order logic formulas as context-free grammar in BNF}]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6549</id>
		<title>Logic</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6549"/>
		<updated>2025-03-13T20:49:06Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Language_first_order_logic_BNF_grammar.jpg|460px|thumb|center|Figure 15: Language of syntactically valid first order logic formulas as context-free grammar in BNF}]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Linear_Algebra_and_Algorithms&amp;diff=6548</id>
		<title>Linear Algebra and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Linear_Algebra_and_Algorithms&amp;diff=6548"/>
		<updated>2025-03-13T20:47:22Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;linear-algebra-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Linear Algebra and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on linear algebra the reader is referred to the book [Lang(1987)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-algebra&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Linear Algebra ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basic-terms-and-definitions&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basic terms and definitions ===&lt;br /&gt;
&lt;br /&gt;
A vector is a one-dimensional array of scalars, i.e. real or complex numbers. We will denote a vector by lowercase bold letters, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}&amp;lt;/math&amp;gt;. In linear algebra two forms of vectors are distinguished: row vector and column vector. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(&lt;br /&gt;
\begin{array}{llllll}&lt;br /&gt;
2 &amp;amp; 1 &amp;amp; 4 &amp;amp; 5 &amp;amp; 3&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a row vector and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
2 \\&lt;br /&gt;
1 \\&lt;br /&gt;
5 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a column vector.&lt;br /&gt;
&lt;br /&gt;
An &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix is a two-dimensional array of scalars having &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; rows an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; columns. The scalar elements of matrix can be real or complex numbers. We consider only real matrices, i.e. matrices with real elements. Matrices will be denoted by uppercase bold letters. For example matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf F} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 4&amp;lt;/math&amp;gt; matrix. Matrices can be seen as generalization of vectors, and thus vectors as special cases of matrices, where either the number of columns or rows is one. So the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-element row vector is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \times n&amp;lt;/math&amp;gt; matrix and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-element column vector is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; matrix.&lt;br /&gt;
&lt;br /&gt;
A square matrix has the same number of rows and columns, i.e. is of type &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt;, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is called as the order of the square matrix. An example of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; is given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf S} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
1 &amp;amp; 1 &amp;amp; 3 \\&lt;br /&gt;
7 &amp;amp; 2 &amp;amp; 10 \\&lt;br /&gt;
4 &amp;amp; 5 &amp;amp; 3  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A diagonal matrix is a special square matrix, in which only the diagonal elements can differ from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. An example for the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf D} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 4 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 4&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diagonal matrix can be given also by means of a diag() operation by listing only the diagonal elements of the matrix as its arguments. For example the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; can be given on such a way as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf D} = diag(3,4,0,4).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The element in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of a matrix is referred as the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element of that matrix and is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}_{i,j}&amp;lt;/math&amp;gt;. It is usual to construct a matrix by the help of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt; . If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; denotes a defining formula of double indexed scalars for some range of indices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; then matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is composed as grouping the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; by two dimensions, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; describes the row index and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; the column index. Therefore the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is set to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; for every values of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; in their given ranges. For example if the double indexed scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;z_{ij}&amp;lt;/math&amp;gt; are defined as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;z_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~} i == j ~~  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\} ~ i,j = 1,2,3.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then defining matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = [\ z_{ij} ]\ &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
leads to &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; identity matrix. The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; identity matrix for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \in \mathbb{N}^+&amp;lt;/math&amp;gt; is characterized by having the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; in its every diagonal positions and all its other elements are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. Therefore the identity matrix is a special diagonal matrix. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; stands for the column vector having the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; on its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th position, while its every other elements are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. In an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean space the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt; represents the unit vector in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th dimension. For example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; the unit vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; are given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 1} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
1 \\&lt;br /&gt;
0 \\&lt;br /&gt;
0&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 2} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
0 \\&lt;br /&gt;
1 \\&lt;br /&gt;
0&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 3} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
0 \\&lt;br /&gt;
0 \\&lt;br /&gt;
1&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; identity matrix can be also expressed as row vector of the unit vectors as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
{\bf e}_{\bf 1} &amp;amp; {\bf e}_{\bf 2} &amp;amp; {\bf e}_{\bf 3} &lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elementary-matrix-operations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Elementary matrix operations ===&lt;br /&gt;
&lt;br /&gt;
An elementary univariate operation on matrices is the transpose operation. The transpose of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is defined by exchanging its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element by its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(j,i)&amp;lt;/math&amp;gt;-th element for each pair of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; in their given ranges. The transpose of a matrix is called transposed matrix and transpose of a given matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^T&amp;lt;/math&amp;gt;. For example the transpose of the above defined matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf F}^T =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 1 &amp;amp; 4 \\ &lt;br /&gt;
3 &amp;amp; 4 &amp;amp; 8 \\&lt;br /&gt;
6 &amp;amp; 10 &amp;amp; 2 \\&lt;br /&gt;
1 &amp;amp; 5 &amp;amp; 4&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The transpose of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; matrix and thus the transpose operation changes the dimensionality of the matrix for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \neq m&amp;lt;/math&amp;gt;. The transpose of square matrix remains a square matrix. The transpose of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \times n&amp;lt;/math&amp;gt; row matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column matrix and vice versa.&lt;br /&gt;
&lt;br /&gt;
The multiplication of matrix by a scalar is defined elementwise, i.e.by multiplying each element of the matrix by the given scalar. For example matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt; multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c=3&amp;lt;/math&amp;gt; gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c {\bf F} =3 \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)= \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
6 &amp;amp; 9 &amp;amp; 18 &amp;amp; 3\\&lt;br /&gt;
3 &amp;amp; 12 &amp;amp; 30 &amp;amp; 15\\&lt;br /&gt;
12 &amp;amp; 24 &amp;amp; 6 &amp;amp; 12 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two matrix can be added if they are of same type, i.e. both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt;. Similarly a matrix can be substracted form another one if they are of same type. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 4&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf G}&amp;lt;/math&amp;gt; is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf G} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
7 &amp;amp; -2 &amp;amp; 5 &amp;amp; -4\\&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; -1 &amp;amp; 3\\&lt;br /&gt;
-4 &amp;amp; 1 &amp;amp; 4 &amp;amp; 2 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T}&amp;lt;/math&amp;gt; as the sum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf G} +  {\bf F}&amp;lt;/math&amp;gt; are given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf T}={\bf G} + {\bf F} &amp;amp;=\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
7 &amp;amp; -2 &amp;amp; 5 &amp;amp; -4\\&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; -1 &amp;amp; 3\\&lt;br /&gt;
-4 &amp;amp; 1 &amp;amp; 4 &amp;amp; 2 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) + &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
9 &amp;amp; 1 &amp;amp; 11 &amp;amp; -3\\&lt;br /&gt;
3 &amp;amp; 7 &amp;amp; 9 &amp;amp; 8\\&lt;br /&gt;
0 &amp;amp; 9 &amp;amp; 6 &amp;amp; 6 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two matrix can be multiplied if the number of columns of the first matrix and the number of rows of the second one are the same. The multiplication of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times k&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, gives an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times k&amp;lt;/math&amp;gt; times product matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt;. Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j,k&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,k&amp;lt;/math&amp;gt;-th elements of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; be &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_{jk}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_{ik}&amp;lt;/math&amp;gt;, respectively. Then the matrix multiplication&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf P} = {\bf A} {\bf B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is defined by the elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;p_{ik} = \sum_{j=1}^{m} a_{ij} b_{jk} ~~\mathrm{~for~} i=1,\ldots,n, ~~k=1,\ldots, k.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,k)&amp;lt;/math&amp;gt;-th element of the product matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; is the (scalar) product of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-th column of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; both consisting of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; elements. In order to illustrate the matrix multiplication we define the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4 \times 3&amp;lt;/math&amp;gt; times matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf H} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
-1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the matrix product &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F} {\bf H}&amp;lt;/math&amp;gt; results in a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; times matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt;, which is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf R} = {\bf F} {\bf H} &amp;amp;=\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
-1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\ &amp;amp;= \left(\begin{array}{lll}&lt;br /&gt;
22 &amp;amp; 8 &amp;amp; 14 \\ &lt;br /&gt;
52 &amp;amp; 27 &amp;amp; 21 \\&lt;br /&gt;
22 &amp;amp; 14 &amp;amp; 36&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}&amp;lt;/math&amp;gt; stands for the column vector having every element set to value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. It is called unit vector. Multiplying a matrix from right by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}&amp;lt;/math&amp;gt; gives the row sums of that matrix in a column vector form. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf H}{\bf e} = \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
    1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
    -1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
    3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
    5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
    1  \\ &lt;br /&gt;
    1  \\&lt;br /&gt;
    1 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
    2 \\ &lt;br /&gt;
    2  \\&lt;br /&gt;
    4  \\&lt;br /&gt;
    10&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gives the row sum of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The addition of matrices is commutative and associative, i.e. the following relations hold for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{O1.~}{\bf A}+{\bf B} = {\bf B}+ {\bf A}, ~~~~~~~~~~~~~~~~~~\mathrm{~commutativity~of~}+\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{O2.~}{\bf A}+\left({\bf B} + {\bf C}\right) = \left({\bf A}+{\bf B}\right) + {\bf C}~~\mathrm{~associativity~of~}+&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix multiplication is distributive with respect to the matrix addition and matrix multiplication is associative, i.e. the following relations hold for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times k&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k \times l&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{O3.~}{\bf A} \left({\bf B}+{\bf D} \right) = {\bf A} {\bf B} + {\bf A}{\bf D} , ~~\mathrm{~distributivity~of~}*\mathrm{~with~respect~to~}+\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{O4.~}{\bf A}\left({\bf B}{\bf C}\right) = \left({\bf A}{\bf B}\right){\bf C}~~~~~~~~~~~\mathrm{~associativity~of~}*&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However matrix multiplication is in general, except from some special cases, NOT commutative, i.e. for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{O5.~}{\bf A}{\bf B} \neq {\bf B}{\bf A}\mathrm{~in~general~}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore multiplication/product of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; is not specified. Instead one should speak about multiplying matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; from right (by default) or from left.&lt;br /&gt;
&lt;br /&gt;
The special classes of matrices, for which commutativity holds includes&lt;br /&gt;
&lt;br /&gt;
* multiplication by identity matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf I}={\bf I}{\bf A}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* multiplication of diagonal matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 2}&amp;lt;/math&amp;gt; with each other: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 1}{\bf D}_{\bf 2}={\bf D}_{\bf 2}{\bf D}_{\bf 1}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* multiplication of two powers of the same matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^n{\bf A}^m = {\bf A}^m{\bf A}^n&amp;lt;/math&amp;gt; and&lt;br /&gt;
* multiplication of two polynomials of the same matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_1({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_2({\bf A})&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_1({\bf A}) P_2({\bf A})=P_2({\bf A}) P_1({\bf A})&amp;lt;/math&amp;gt;, which follows from the commutativity of two powers of the same matrix by repetitive application of distributivity of the matrix multiplication.&lt;br /&gt;
&lt;br /&gt;
Further useful relations are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\left({\bf A}+{\bf B}\right)^T={\bf A}^T + {\bf B}^T \\&lt;br /&gt;
&amp;amp; \left({\bf A}{\bf B}\right)^T={\bf B}^T  {\bf A}^T.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The major difference of the elementary matrix operations comparing to their scalar counterparts is that matrix multiplication is not commutative in general. This has far-reaching consequences for the matrix theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-independence-of-vectors&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Linear independence of vectors ===&lt;br /&gt;
&lt;br /&gt;
The expression&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c_1{\bf v}_{\bf 1} + \ldots c_n{\bf v}_{\bf n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is called as a linear combination of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 1}, \ldots, {\bf v}_{\bf n}&amp;lt;/math&amp;gt; and the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_1,\ldots, c_n&amp;lt;/math&amp;gt; are weights. Linear, since the used operations &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+&amp;lt;/math&amp;gt; and constant multiplication are linear.&lt;br /&gt;
&lt;br /&gt;
For example each vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; pointing to a point in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space can be given as a linear combinations of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w} = x{\bf e}_{\bf 1} + y{\bf e}_{\bf 2} + z{\bf e}_{\bf 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We say that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; span the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space and hence generate the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional space. There are infinite many other vector combinations, which span the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space, the vector are not necessarily be perpendicular to each other, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 1}=(1,2,3)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 2}=(-1,1,2)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 3} = (0,0,1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However if we consider the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}=(1,0,0)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}=(0,1,0)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0} = (2,3,0)&amp;lt;/math&amp;gt; then we can only cover the vectors at the plane with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;z=0&amp;lt;/math&amp;gt; by the linear combinations of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt;. In this case we say that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; generate (or span) only a (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt;-dimensional) sub-space of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space. This is because the 3rd vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; can be given as the linear combination of the other two as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf v}_{\bf 0} = 2{\bf e}_{\bf 1} + 3{\bf e}_{\bf 2}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This phenomena is characterised by saying that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; are not linear independent of each other. In fact not only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; can be given as linear combination of the other two, but any of the three vectors can be given as a linear combination of the other two. The vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; are linear dependent.&lt;br /&gt;
&lt;br /&gt;
However the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; behave on another way, none of them can be given as linear combination of the other two. We say the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; are linear independent. Among the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; only any two of them are linear independent of each other.&lt;br /&gt;
&lt;br /&gt;
It can be seen that a given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; number of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vectors determine the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space if and only if they are linear independent. If they are linear dependent and only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt; of them are linear independent, then they generate (or span) only a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-dimensional sub-space of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space.&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; vectors are collected in a matrix, for example each vector put in a different row of the matrix, then the maximum number number of linear independent row vectors of the matrix is called as the rank of that matrix. The vectors can be put also in the different columns of a matrix, in which case the the maximum number of linear independent column vectors of the matrix is the rank of that matrix. It can be seen that the maximum number of linear independent rows and the maximum number of linear independent columns of a matrix are the same, so each matrix has a unique rank. The rank of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt;. Based on the above the rank of a matrix is the dimension of the subspace generated by its columns or rows as vectors.&lt;br /&gt;
&lt;br /&gt;
It follows that the the statements below hold for the rank of a matrix.&lt;br /&gt;
&lt;br /&gt;
* The rank of an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is at most the smaller of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;rank({\bf A}) \leq \min(n,m).&amp;lt;/math&amp;gt;&lt;br /&gt;
* The rank of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is at most its order, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;rank({\bf A}) \leq n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;determinant&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Determinant ===&lt;br /&gt;
&lt;br /&gt;
The determinant is a scalar assigned to a square matrix. It depends on every elements of the matrix, hence determinant is a scalar function of the square matrix. The determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; (or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det{\bf A}&amp;lt;/math&amp;gt;) and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|{\bf A}|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Expression of determinant - Leibniz formula&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The determinant is a sum of signed products, where each product is composed as a multiplication of elements taken from each row of the square matrix, each of them at different column positions and every such products are included in the sum. In other words the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}= [\ a_{i j} ]\ &amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A})= \sum_{p} sgn(p) a_{1 p(1)} \ldots a_{n p(n)} = \sum_{p} sgn(p) \left(\prod_{i=1}^n a_{i p(i)}\right),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p=p(1) \ldots p(n)&amp;lt;/math&amp;gt; is a permutation of the column indices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \ldots n&amp;lt;/math&amp;gt; and the sign function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sgn(p)&amp;lt;/math&amp;gt; assigns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+1&amp;lt;/math&amp;gt; to a permutation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; if it can be created by even number of exchanges of two numbers starting from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \ldots n&amp;lt;/math&amp;gt; and otherwise it gives &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-1&amp;lt;/math&amp;gt;. The number of products in the sum equals to the number of possible permutations, which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n!&amp;lt;/math&amp;gt;. This expression of the determinant is called Leibniz formula.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; there are only two permutations, therefore the expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A}) = ad-bc.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix - Sarrus rule&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\ &amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; there are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3!=6&amp;lt;/math&amp;gt; permutations, three of them are encountered with sign &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+&amp;lt;/math&amp;gt; and the other three with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-&amp;lt;/math&amp;gt;. The expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
det({\bf A}) &amp;amp;= a_{11}a_{22}a_{33} + a_{12}a_{23}a_{31} + a_{13}a_{21}a_{32} \\&lt;br /&gt;
             &amp;amp;- a_{31}a_{22}a_{13} - a_{32}a_{23}a_{11}- a_{33}a_{21}a_{12}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This expression can be easily memorized by the help of the Sarrus rule, see in Figure [[#fig:Sarrus_rule|12]]. Copying the first two columns of the matrix right to it, the products with positive sign can be obtained along the diagonals from top to down and right, while the products with negative sign are the ones from down to top and right.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Sarrus_rule&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Sarrus_rule1.png|460px|thumb|center|Figure 12: Illustration of Sarrus rule for computing the determinant of $3 \times 3$ matrix (Source: By Kmhkmh - Own work, CC BY 4.0, \url{https://commons.wikimedia.org/w/index.php?curid=127614131})]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Unfortunately the schema of Sarrus can not be generalized for higher dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Geometric interpretation&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The columns of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be interpreted as vectors in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean space. For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; these vectors span a parallelogram, and the determinant is exactly the signed value of the area of this parallelogram. This is shown in Figure [[#fig:2D_det_area|13]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:2D_det_area&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:2D_determinant_as_area_parallelogram.png|460px|thumb|center|Figure 13: Geometric interpretation of determinant of 2D square matrix as area of parallelogram (Source: By TheWanderingTraders - This SVG diagram includes elements that have been taken or adapted from this diagram:, CC BY-SA 4.0, \url{https://commons.wikimedia.org/w/index.php?curid=158528546})]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; the column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_3&amp;lt;/math&amp;gt;, form a parallelepiped and the determinant gives the signed volume of this parallelepiped, see in Figure [[#fig:3D_det_area|14]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:3D_det_area&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:3D_determinant_as_area_parallelepiped.png|460px|thumb|center|Figure 14: Geometric interpretation of determinant of 3D square matrix as area of parallelepiped (By Claudio Rocchini - Own work, CC BY 3.0, \url{https://commons.wikimedia.org/w/index.php?curid=2788190})]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This interpretation holds also for higher dimensions. So the column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; span a parallelotope in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space and the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; gives its signed &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional volume.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of determinant&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Determinant of several special matrices&lt;br /&gt;
&lt;br /&gt;
* Determinant of identity matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf I})= 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Determinant of diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = diag(d_1,\ldots,d_n)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf D}) = d_1 \ldots d_n = \prod_{i=1}^{n}d_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; has the following properties regarding row and column manipulations.&lt;br /&gt;
&lt;br /&gt;
# Multiplying matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; results in multiplication of the determinant by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c^n&amp;lt;/math&amp;gt;, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;.&amp;lt;/math&amp;gt;&lt;br /&gt;
# Multiplying any row or any column of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; leads to a multiplication of the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt;. In other words the determinant of the modified matrix is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c~det({\bf A})&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Exchanging two rows or two columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; leads to a multiplication of the determinant by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Adding a scalar multiplication of another row to a row of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; or adding a scalar multiplication of another column to a column of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; does not change the value of the determinant.&lt;br /&gt;
&lt;br /&gt;
Further useful properties of the determinant are &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{D1.~}det({\bf A}^T) = det({\bf A})\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}  \\&lt;br /&gt;
    &amp;amp;\mathrm{D2.~}det(c{\bf A})= c^n det({\bf A})~~ c \in \mathbb{R}\\&lt;br /&gt;
    &amp;amp;\mathrm{D3.~}det({\bf A}{\bf B}) = det({\bf A})det({\bf B}) \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Laplace expansion&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The minor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_{i,j}&amp;lt;/math&amp;gt; of of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} =[\ a_{i j} ]\ &amp;lt;/math&amp;gt; is defined as the determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-1) \times (n-1)&amp;lt;/math&amp;gt; submatrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, which is obtained by omitting the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1,\ldots,n&amp;lt;/math&amp;gt;. The determinant of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be expressed by expanding it along its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row. This gives a sum of signed product of each element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row by its corresponding minor. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A})= \sum_{j=1}^n (-1)^{(i+j)} a_{ij} M_{i,j}.&amp;lt;/math&amp;gt; This is called as Laplace expansion along the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As an example we show the Laplace expansion of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with general notations along its 1st row, which leads to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
det({\bf A})&amp;amp;=\left| \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| \\&lt;br /&gt;
&amp;amp;= a_{11} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| - a_{12} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{21} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| + a_{13} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{21} &amp;amp; a_{22}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right|.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; The Laplace expansion along the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be also defined on similar way.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant and linear independence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the most important use of the determinant is its relation to linear independence. The determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-zero if and only if the rows (and columns) of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear independent.&lt;br /&gt;
&lt;br /&gt;
This can be seen e.g. by the help of the geometric interpretation of the determinant. If the column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear independent then they generate the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space and thus the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-volume of the parallelotope spanned by them must be non-zero and therefore also the determinant is non-zero. However if the column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear dependent then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; generate only a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt;-dimensional subspace of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space, which implies that the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-volume of the parallelotope spanned by them must be zero and hence also the determinant is zero.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;inverse-matrix&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Inverse matrix ===&lt;br /&gt;
&lt;br /&gt;
We consider the question whether a matrix does exist, which multiplied by the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; results in the identity matrix. It would be an analogue of the reciprocal number in the set of real (or complex) numbers. Immediately the following questions arise&lt;br /&gt;
&lt;br /&gt;
* What is the condition of the existence of an such matrix ? Not every number has reciprocal also in the set of real numbers (i.e. the number zero).&lt;br /&gt;
* If such matrices exist for multiplying by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; both from left and right, then they are the same ?, This question is due to the general non-commutativity of the matrices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The adjugate matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The adjugate matrix of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;, and it is defined as the transpose of the matrix of the signed minors. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; is given by its elements as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i,j} = (-1)^{(i+j)} M_{j,i} ~~ i,j = 1,\ldots,n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The importance of the adjugate matrix lies in the following relation, which holds for every square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} adj({\bf A}) = adj({\bf A}){\bf A} = det({\bf A}){\bf I}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The inverse matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is an invertable matrix if there exist a matrix, which is multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; from left gives the identity matrix and multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; from right also gives the identity matrix. This matrix is called the inverse matrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt;. Thus for the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; holds the following defining relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} {\bf A}^{-1} = {\bf A}^{-1}{\bf A} = {\bf I}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dividing the above relation for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt;, it leads to expression of the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = \frac{adj({\bf A})}{det({\bf A})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the adjugate matrix always exists, the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; exists if and only the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-zero. The square matrix which is not invertable is also called as singular matrix. Similarly the invertable matrix is also called as non-singular. Therefore&lt;br /&gt;
&lt;br /&gt;
* The square matrix is singular if and only if its determinant is zero.&lt;br /&gt;
* The square matrix is non-singular if and only if its determinant is non-zero.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Inverse of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=ad-bc&amp;lt;/math&amp;gt; Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; all the minors are scalars. Hence the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; can be expressed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = \frac{adj({\bf A})}{det({\bf A})} = \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    d &amp;amp; -b  \\ &lt;br /&gt;
    -c &amp;amp; a \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be checked by multiplying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} {\bf A}^{-1} = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    d &amp;amp; -b  \\ &lt;br /&gt;
    -c &amp;amp; a \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc} = \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    ad-bc &amp;amp; -ab+ab  \\ &lt;br /&gt;
    cd-cd &amp;amp; -cb+da \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; 0  \\ &lt;br /&gt;
0 &amp;amp; 1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; as expected. It is easy to remember the nominator of the inverse of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix: the values in the main diagonal (a and d) are exchanged and the values in the secondary diagonal (b and c) are multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(-1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Inverse of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\ &amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; all the minors are determinants of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt;-dimensional matrix. Hence the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; can be expressed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf A}^{-1} &amp;amp;= \frac{adj({\bf A})}{det({\bf A})} = \frac{\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
M_{11} &amp;amp; -M_{21} &amp;amp; M_{31}  \\ &lt;br /&gt;
-M_{12} &amp;amp; M_{22} &amp;amp; -M_{32}  \\ &lt;br /&gt;
M_{13} &amp;amp; -M_{23} &amp;amp; M_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)}{det({\bf A})} \\&lt;br /&gt;
&amp;amp;= \frac{\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; \left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{22} &amp;amp; a_{23}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| \\ &lt;br /&gt;
-\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{21} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp;\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{23}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right|  \\ &lt;br /&gt;
\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{21} &amp;amp; a_{22}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{12}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; \left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{12}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right|&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)}{det({\bf A})}&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of the inverse matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inverse matrix of several special matrices&lt;br /&gt;
&lt;br /&gt;
* Inverse matrix of identity matrix is itself. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}^{-1}= {\bf I}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Inverse matrix of diagonal matrix is also diagonal.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = diag(d_1,\ldots,d_n)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d_i \neq 0&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}^{-1} =diag(\frac{1}{d_1},\ldots,\frac{1}{d_n})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Further useful properties of the inverse matrix are &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{I1.~}({\bf A}^{-1})^{-1} = {\bf A}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{I2.~}({\bf A}^T)^{-1} = ({\bf A}^{-1})^T \\&lt;br /&gt;
&amp;amp;\mathrm{I3.~}(c{\bf A})^{-1}= c^{-1} {\bf A}^{-1} ~~ c \in \mathbb{R}\\&lt;br /&gt;
&amp;amp;\mathrm{I4.~}({\bf A}{\bf B})^{-1} = {\bf B}^{-1}{\bf A}^{-1} \\&lt;br /&gt;
&amp;amp;\mathrm{I5.~}det({\bf A}^{-1}) = det({\bf A})^{-1} &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-systems-of-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Linear systems of equations ===&lt;br /&gt;
&lt;br /&gt;
The linear system of equations consisting of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1,\ldots,x_n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; equations can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;a_{11}x_1 + a_{12}x_2 + \ldots + a_{1n}x_n = b_1 \\&lt;br /&gt;
&amp;amp;a_{21}x_1 + a_{22}x_2 + \ldots + a_{2n}x_n = b_2 \\&lt;br /&gt;
&amp;amp;\vdots \\&lt;br /&gt;
&amp;amp;a_{m1}x_1 + a_{m2}x_2 + \ldots + a_{mn}x_n = b_m.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; This can be also called as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations. By introducing the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times 1&amp;lt;/math&amp;gt; column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =[\ a_{ij} ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
x_1 \\&lt;br /&gt;
x_2 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
x_n \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf b} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
b_1 \\&lt;br /&gt;
b_2 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
b_m \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the system of linear equations can be rewritten in matrix vector form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}.&amp;lt;/math&amp;gt; Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is the coefficient matrix, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; is a column vector of unknowns or unknown column vector and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; is given column vector.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Reformulation - linear combination of column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above system of linear equations can be rewritten by the help of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt; on index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\  =[\ b_i ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ b_i ]\ &amp;lt;/math&amp;gt; is a vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; due to the application of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt;. The order of grouping on index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and summing can be exchanged on the left hand side of the equation, which gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\sum_{j=1}^{n} [\ a_{ij}]\ x_j   =[\ b_i ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Introducing the column vectors composed from the columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf a}_{\bf j} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
a_{1j} \\&lt;br /&gt;
a_{2j} \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
a_{nj} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) ~~j = 1,\ldots, n,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the relation can be further rearranged as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\sum_{j=1}^{n} {\bf a}_{\bf j} x_j = {\bf b},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on this formulation, the problem of solving the above &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations can be seen as finding the weights &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;-s, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; with which the given vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed as the linear combination of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;- dimensional vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This interpretation enables to establish criteria for solvability for different cases of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations depending on the relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; as well as the linear independence of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solvability - general case&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following statements follow from the above linear combination interpretation for the solvability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations.&lt;br /&gt;
&lt;br /&gt;
# The linear system of equations is solvable if and only if vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed as linear combination of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;, in other words if the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; and vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; are linear dependent. This means that adding vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; to the set of vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; does not increase the number of linear independent vectors in the set. This is equivalent to the statement that the extended matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^*&amp;lt;/math&amp;gt; obtained as adding column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n+1)&amp;lt;/math&amp;gt; column to matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, has the same rank as matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt; then two cases must be distinguished according to the relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
#* If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt; then the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; generate the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space, in which the weights of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; is unique, therefore the system has a unique solution. Note that in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \geq n&amp;lt;/math&amp;gt; must be, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt; can not be greater than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\min(m,n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
#* If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=rank({\bf A})&amp;lt;n&amp;lt;/math&amp;gt; then the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; generate a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-dimensional space, in which only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt; components of the the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed by linear combination of the the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;. Therefore in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n-k&amp;lt;/math&amp;gt; unknowns can be freely selected and the system has infinite many solutions. Note that in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \geq rank({\bf A})&amp;lt;/math&amp;gt;, so it can be also smaller than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The different cases of solvability and their criteria are summarized in Table [[#tab:solv_lse|1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:solv_lse&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Solvability criteria of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  Rank criterion  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   General case  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Special case  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Homogeneous system  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) \neq rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   No solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   - Not possible -  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Unique solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Only trivial solution  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Infinite many  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Also non-trivial  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions,  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   infinite many  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   unknowns can be  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   chosen freely &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   free parameters  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solvability - square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several further findings can be obtained for the special case of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt; then matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-singular and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) \neq 0&amp;lt;/math&amp;gt;. Otherwise matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is singular and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking all these into account the solvability conditions for the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be summarized in a slightly simplified form, which is shown in Table [[#tab:solv_lse_sm|2]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:solv_lse_sm&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Solvability criteria of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; linear system of equations&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  Rank criterion  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Inhomogeneous system &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  Homogeneous system &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;   &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) \neq 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Unique solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Only trivial solution  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;) &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf A}^{-1}{\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Infinite many  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  Also non-trivial  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;) and  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions,  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   infinite many &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   unknowns can be  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   chosen freely  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   free parameters  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   No solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   - Not possible -  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;) and  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) \neq rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;eigenvectors-eigenvalues-spectral-decomposition&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eigenvectors, eigenvalues, spectral decomposition ===&lt;br /&gt;
&lt;br /&gt;
For a given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; finding the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; satisfying the equation&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf u} = \lambda{\bf u}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
called as eigenvalue problem of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. The scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; satisfying the equation are called eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; satisfying the equation are called eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Transforming an eigenvector by multiplying it by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; gives a vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda{\bf u}&amp;lt;/math&amp;gt; being parallel to the considered eigenvector. Hence the transformation by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; does not change the direction of the eigenvectors and their length will be multiplied by the eigenvalue. This explains the names eigenvectors and eigenvalues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Characteristic polynomial&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rearranging the above relation gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right) {\bf u} = {\bf 0}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is homogeneous system of linear equations, which has non-trivial solution only if the determinant of the coefficient matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right)&amp;lt;/math&amp;gt; is zero, in other words, if &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det\left({\bf A}- \lambda {\bf I}\right)=0.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; arises in each element of the main diagonal of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right)&amp;lt;/math&amp;gt;. It follows that the permutation giving the products of the main diagonal and therefore also the determinant of this matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;. This &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is called the characteristic polynomial of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Its solutions give the eigenvalues. According to the fundamental theory of algebra, an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial has exactly &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; solutions in the set of complex numbers. It follows that there exist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; complex eigenvalues implying at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; real eigenvalues, from which some of them can arise more times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algebraic multiplicity and geometric multiplicity&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, s&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \leq n&amp;lt;/math&amp;gt; denote the eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. The number of arising of the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; in the solution of the characteristic polynomial is called the algebraic multiplicity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;. For each &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; the homogeneous system&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left({\bf A}- \lambda_i {\bf I}\right) {\bf u} = {\bf 0}.&amp;lt;/math&amp;gt; determines the eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;. Due to the homogeneous character of the system, its solution must have at least one free parameter. This is manifested in the fact that any constant multiplication of an eigenvector is also a solution of a system. Hence an eigenvector is determined only up to a constant multiplication, i.e. only the direction (in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean system) of the eigenvector is determined, but its length not. The number of linearly independent eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; can be one or more depending on the rank of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda_i {\bf I}\right)&amp;lt;/math&amp;gt;. In fact linearly independent eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; is the number of freely selectable parameter, which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n-rank({\bf A}- \lambda_i {\bf I})&amp;lt;/math&amp;gt;, which is called the geometric multiplicity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; An example for determining eigenvalues an eigenvectors&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1-a &amp;amp; a \\&lt;br /&gt;
b &amp;amp; 1-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right), ~~ a,b \geq 0.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Computing the eigenvalues of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\lambda {\bf I} - {\bf A}| = \left(\lambda - (1 - a)\right)\left(\lambda - (1-b)\right)-ab = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda^2 - \lambda (1-a+1-b)+(1-a)(1-b)-ab =0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda^2 - \lambda (2-a-b)+1-a-b =0&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \lambda_{1,2} &amp;amp;= \frac{(2-a-b)\pm \sqrt{(2-a-b)^2-4(1-a-b)}}{2} \\&lt;br /&gt;
        &amp;amp;= \frac{(2-a-b)\pm \sqrt{4-4(a+b)+(a+b)^2-4+4(a+b)}}{2} \\&lt;br /&gt;
    &amp;amp;=\frac{(2-a-b)\pm(a+b)}{2}\\&lt;br /&gt;
    &amp;amp;\Rightarrow ~~ \lambda_1 = 1,~ \mathrm{(since~the~matrix~} {\bf A} \mathrm{~stochastic~is,)~and} \\&lt;br /&gt;
    &amp;amp;~~~ \lambda_2 = 1-a-b. &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Determining the eigenvectors of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&lt;br /&gt;
#* The eigenvector belonging to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1=1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;({\bf A} - {\bf I}) {\bf u}_{\bf 1} = {\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(&lt;br /&gt;
        \begin{array}{ll}&lt;br /&gt;
        -a &amp;amp; a \\&lt;br /&gt;
        b &amp;amp; -b  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) \left(&lt;br /&gt;
        \begin{array}{l}&lt;br /&gt;
        u_1  \\&lt;br /&gt;
        u_2  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) =\left( \begin{array}{l}&lt;br /&gt;
        0  \\&lt;br /&gt;
        0&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-a u_1 + a u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b u_1 - b u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1} =\left( \begin{array}{l}&lt;br /&gt;
        1  \\&lt;br /&gt;
        1&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
#* The eigenvector corresponding to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2= 1-a-b&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;({\bf A} - (1-a-b){\bf I}) {\bf u}_{\bf 2} = {\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(&lt;br /&gt;
        \begin{array}{ll}&lt;br /&gt;
        b &amp;amp; a \\&lt;br /&gt;
        b &amp;amp; a  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) \left(&lt;br /&gt;
        \begin{array}{l}&lt;br /&gt;
        u_1  \\&lt;br /&gt;
        u_2  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) =\left( \begin{array}{l}&lt;br /&gt;
        0  \\&lt;br /&gt;
        0&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b u_1 + a u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
        1  \\&lt;br /&gt;
        \frac{-b}{a}&lt;br /&gt;
        \end{array} &lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;    or    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
        a  \\&lt;br /&gt;
        -b&lt;br /&gt;
        \end{array} &lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;,  since the eigenvectors are only determined up to a multiplicative constant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Left and right eigenvalues and eigenvectors&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So far we considered the form of the eigenvalue problem, in which the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; being a column vector and hence locates on the right side of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. From this reason this eigenvalue problem is also called as right eigenvalue problem, and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;-s and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt;-s are also called as right eigenvalues and right eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
There is a similar eigenvalue problem, in which the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is a row vector and arises on the left hand side of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf v}{\bf A} = {\bf v}\lambda,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and it called as left eigenvalue problem. The solution &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;-s and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}&amp;lt;/math&amp;gt;-s are also called as left eigenvalues and left eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The two kind of eigenvalue problem can be related by transposing them into each other. For example transposing the right eigenvalue problem gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf u}^T{\bf A}^T = {\bf u}^T\lambda.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows the relation between the two kind of eigenvalue problem, which can be formulated as follows. The right side eigenvalues and eigenvectors of square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are the left side eigenvalues and eigenvectors of the transpose of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively. It follows that for a symmetric matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; the right and the left side eigenvalues and eigenvectors are the same, respectively, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}=&amp;lt;/math&amp;gt;&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;S&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;^T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of eigenvalues&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda({\bf A})_i&amp;lt;/math&amp;gt; stands for the eigenvalues and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th eigenvalue, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots,n&amp;lt;/math&amp;gt; of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively. Useful properties of the eigenvalues are given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{E1.~}\lambda(c{\bf A})= c \lambda({\bf A}) ~~ c \in \mathbb{R}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
&amp;amp;\mathrm{E2.~}\lambda({\bf A}^{-1}) = \left(\lambda{\bf A}\right)^{-1}\\&lt;br /&gt;
&amp;amp;\mathrm{E3.~}\prod_{i=1}^n \lambda({\bf A})_i = det({\bf A})&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The spectral decomposition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is a factorization into the canonical form as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}&amp;lt;/math&amp;gt; is a diagonal matrix. The spectral decomposition is also called eigendecomposition or diagonalisation.&lt;br /&gt;
&lt;br /&gt;
The matrices arising in the factorization can be interpreted as follows. The diagonal elements of the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}&amp;lt;/math&amp;gt; are the right eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Note that each eigenvalue arises in the diagonal as many times as its algebraic multiplicity. The column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are the right eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_k&amp;lt;/math&amp;gt; eigenvalues, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=1,\ldots, n&amp;lt;/math&amp;gt;. Thus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_k&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; satisfies&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf u}_{\bf k} = {\bf u}_{\bf k} \lambda_k, ~~ k=1,\ldots, n,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be arranged in matrix form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf U} = {\bf U}{\bf \Lambda}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the fact that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; is determined only up to a constant, does not influence the canonical form of the spectral decomposition. This can be seen by replacing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_k{\bf u}_{\bf k}&amp;lt;/math&amp;gt;, in matrix form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}{\bf C}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}=diag(c_1,\ldots, c_n&amp;lt;/math&amp;gt;, in the canonical form, which leads to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf U}{\bf C}{\bf \Lambda}\left({\bf U}{\bf C}\right)^{-1}= {\bf U}{\bf C}{\bf \Lambda}{\bf C}^{-1}{\bf U}^{-1}={\bf U}{\bf C}{\bf C}^{-1}{\bf \Lambda}{\bf U}^{-1} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where we utilized the commutativity of the diagonal matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}{\bf C}^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; An example for spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continuing the the example for determining eigenvalues an eigenvectors of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1-a &amp;amp; a \\&lt;br /&gt;
b &amp;amp; 1-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right), ~~ a,b \geq 0,&amp;lt;/math&amp;gt; now we show the spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So far we have determined the right eigenvalues &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1 = 1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2 = 1-a-b&amp;lt;/math&amp;gt;, and the right eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1} =\left( \begin{array}{l}&lt;br /&gt;
1  \\&lt;br /&gt;
1&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
a  \\&lt;br /&gt;
-b&lt;br /&gt;
\end{array} &lt;br /&gt;
\right)&amp;lt;/math&amp;gt; belonging to them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Composition of diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; The diagonal elements of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; are the eigenvalues &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2&amp;lt;/math&amp;gt;. Thus matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; is given by&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda =\left(&lt;br /&gt;
   \begin{array}{ll}&lt;br /&gt;
   1 &amp;amp; 0\\&lt;br /&gt;
   0 &amp;amp; 1-a-b  &lt;br /&gt;
   \end{array}&lt;br /&gt;
   \right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Composition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; The columns of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are the eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2}&amp;lt;/math&amp;gt;. Thus matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; is given as&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}  = \left(&lt;br /&gt;
   \begin{array}{ll}&lt;br /&gt;
   1 &amp;amp; a \\&lt;br /&gt;
   1 &amp;amp; -b  &lt;br /&gt;
   \end{array}&lt;br /&gt;
   \right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Determination of the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}  = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; a \\&lt;br /&gt;
1 &amp;amp; -b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}  = \frac{1}{\det {\bf U}} \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
-b &amp;amp; -a \\&lt;br /&gt;
-1 &amp;amp; 1  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \frac{1}{-(a+b)} \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
-b &amp;amp; -a \\&lt;br /&gt;
-1 &amp;amp; 1  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
\frac{b}{a+b} &amp;amp; \frac{a}{a+b} \\&lt;br /&gt;
\frac{1}{a+b} &amp;amp; \frac{-1}{a+b}  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;The spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}  = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; a \\&lt;br /&gt;
1 &amp;amp; -b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 1-a-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
\frac{b}{a+b} &amp;amp; \frac{a}{a+b} \\&lt;br /&gt;
\frac{1}{a+b} &amp;amp; \frac{-1}{a+b}  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Conditions for the existence of spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that not every square matrix is diagonalisable. Two useful conditions for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; to be diagonalisable can be given as&lt;br /&gt;
&lt;br /&gt;
# The spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; exists if and only if the number of linearly independent right eigenvectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; equals to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# A sufficient condition for the existence of spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is that its characteristic polynomial has no repeated roots.&lt;br /&gt;
&lt;br /&gt;
Based on the first condition, the canonical form of the spectral decomposition can be derived. The column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are linear independent, so it is non-singular and hence exists the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}&amp;lt;/math&amp;gt;. Multiplying the matrix form relation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf U} = {\bf U}{\bf \Lambda}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}&amp;lt;/math&amp;gt; from right gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf U}{\bf U}^{-1} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt; from which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}{\bf U}^{-1} = {\bf I}&amp;lt;/math&amp;gt; falls out resulting the canonical form of the spectral decomposition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Application of spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spectral decomposition is used im many area of the natural sciences. Below we list several typical example for using spectral decomposition.&lt;br /&gt;
&lt;br /&gt;
# Calculating a power of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^k = \left({\bf U}{\bf \Lambda}{\bf U}^{-1}\right)^k = {\bf U}{\bf \Lambda}^k{\bf U}^{-1},~~ k \in \mathbb{N^+}.&amp;lt;/math&amp;gt;&lt;br /&gt;
# Expressing the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = {\bf U}{\bf \Lambda}^{-1}{\bf U}^{-1},~~ \mathrm{~which~can~be~obtained~by~taking~inverse~of~canonical~form~}.&amp;lt;/math&amp;gt; Such expression of the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; exists if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i \neq 0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Expressing matrix function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf A})&amp;lt;/math&amp;gt; of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf A})&amp;lt;/math&amp;gt; defined by the help of power series of f() &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
        f({\bf A}) = {\bf U}f({\bf \Lambda}){\bf U}^{-1},~~ &amp;amp;\mathrm{~which~can~be~shown~by~using~power~series~form~of~}f({\bf A})\\&lt;br /&gt;
        &amp;amp;\mathrm{~and~above~relation~for~}{\bf A}^k.&lt;br /&gt;
     &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Showing the convergence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_n^{\infty}{\bf A}^n&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
        \sum_n^{\infty}{\bf A}^n,~~ &amp;amp;\mathrm{~convergent~is,~when~} |\lambda_i|&amp;lt; 1,\mathrm{~for~}i=1,\ldots,n.&lt;br /&gt;
     &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;matrix-norms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Matrix norms ===&lt;br /&gt;
&lt;br /&gt;
Eigenvalues can be considered to be a set of numbers characterizing the magnitude of a square matrix. Often the eigenvalue with the highest magnitude has outstanding importance. Besides of it, there is a need for characterising the magnitude of a square matrix only by one number, analogously to the absolute value of a real or complex number.&lt;br /&gt;
&lt;br /&gt;
The matrix norm is a measure characterizing the magnitude of a square matrix by one number. The matrix norm is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|~~ \right\|&amp;lt;/math&amp;gt;, e.g. the norm of the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Definition of several matrix norms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the contrary to the uniqueness of the absolute value, more matrix norms can be defined. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; be the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Then several martix norms can be given as&lt;br /&gt;
&lt;br /&gt;
# Max norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = n\max_{i,j} |a_{ij}|.&amp;lt;/math&amp;gt; Note that there is another, similar norm which is also called as max norm.&lt;br /&gt;
# Max row sum &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = \max_{i}\sum_{j} |a_{ij}|.&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L1&amp;lt;/math&amp;gt; norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = \sum_{i}\sum_{j} |a_{ij}|.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; General properties of matrix norms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix norms are useful tools e.g. in theoretical derivations, like e.g. to prove the existence of an upper limit. In fact in most of the cases the concrete form of the matrix norm is not interesting. Instead some properties of the matrix norm are utilized. These important general properties of matrix norm are listed for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{N1.~}\left\|{\bf A} \right\| \geq 0.\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\mathrm{N2.~}\left\|c{\bf A} \right\| = c \left\|{\bf A} \right\| ~~ ~~ c \in \mathbb{R}.\\&lt;br /&gt;
    &amp;amp;\mathrm{N3.~}\left\|{\bf A} \right\| + \left\|{\bf B} \right\| \geq \left\|{\bf A} + {\bf B} \right\| \mathrm{~-~triangle~ inequality~}. \\&lt;br /&gt;
    &amp;amp;\mathrm{N4.~}\left\|{\bf 0} \right\| = 0. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Useful matrix norms also have the following additional property &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{N5.~}\left\|{\bf A} {\bf B} \right\| \leq \left\|{\bf A} \right\| \left\|{\bf B} \right\|\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
All the three above defined matrix norms have this additional property. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_{jk}&amp;lt;/math&amp;gt; be the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j,k&amp;lt;/math&amp;gt;-th element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, respectively . Then the additional property can be shown for these matrix norms as follows.&lt;br /&gt;
&lt;br /&gt;
# Max norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= n\max_{i,k} |\sum_{j} a_{ij}b_{jk}| \leq n\max_{i,k} \sum_{j} |a_{ij}| |b_{jk}| \\&lt;br /&gt;
    &amp;amp;\leq n^2 \max_{i,j} |a_{ij}|\max_{j,k} |b_{jk}| = n\max_{i,j} |a_{ij}|n\max_{j,k} |b_{jk}| = \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Max row sum &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= \max_{i}\sum_{k}  |\sum_{j} a_{ij}b_{jk}|\leq  \max_{i} \sum_{j} |a_{ij}| \sum_{k}|b_{jk}| \\&lt;br /&gt;
    &amp;amp;\leq  \max_{i} \sum_{j} |a_{ij}| \left(\max_{j} \sum_{k}|b_{jk}| \right)= \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L1&amp;lt;/math&amp;gt; norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= = \sum_{i}\sum_{k} |\sum_{j} a_{ij}b_{jk}| \leq \sum_{i}\sum_{k} \sum_{j} |a_{ij}| |b_{jk}| \\&lt;br /&gt;
    &amp;amp;= \sum_{i} \sum_{j} |a_{ij}|\sum_{k} |b_{jk}| \leq \sum_{i} \sum_{j} |a_{ij}|\left\|{\bf B} \right\| = \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several typical applications of matrix norms are given below.&lt;br /&gt;
&lt;br /&gt;
* To show that a norm of a matrix expression is upper limited.&lt;br /&gt;
* To show that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lim_{n \rightarrow \infty } {\bf A}^n = {\bf 0}&amp;lt;/math&amp;gt;, when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\| &amp;lt; 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* To show that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{n=0}^{\infty} {\bf A}^n&amp;lt;/math&amp;gt; convergent is, when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\| &amp;lt; 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;application-of-linear-algebra&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Application of linear algebra ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solving-system-of-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solving system of equations ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; System of linear equations&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the system of linear equations with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; equations, i.e. with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. This system of linear equations can be written in matrix vector form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Inhomogeneous system with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the case with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt;, which is an important subclass of system of linear equations. Then there is always a unique solution, since the rank can not be changed via extending &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^*&amp;lt;/math&amp;gt;, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*)=\min(n, n+1)= n&amp;lt;/math&amp;gt;. The solution can be given in closed form by multiplying the matrix vector equation by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; from left, which gives the closed form solution as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} ={\bf A}^{-1}{\bf b}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the inverse matrix exists in this case, since matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-singular due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Homogeneous system with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=(n-1)&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that the equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}adj({\bf A}) = det({\bf A}){\bf I}&amp;lt;/math&amp;gt; holds for the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=0&amp;lt;/math&amp;gt; then this leads to &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}adj({\bf A}) = {\bf 0}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; denotes the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th column vector of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots,n&amp;lt;/math&amp;gt;. It follows that any column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; is a solution of the homogeneous equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=0&amp;lt;/math&amp;gt;. If additionally &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt;, then there is only one free parameter. Since any constant multiplication of a column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; is also a solution, it follows that&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \left(adj({\bf A})\right)_{1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \in \mathbb{R}&amp;lt;/math&amp;gt; gives every solution of the homogeneous equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt; and&lt;br /&gt;
* the columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; are constant multiplications of each other if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; System of non-linear equations&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the following system of non-linear equations with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;f_1(x_1,\ldots,x_n) = 0 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
&amp;amp;f_n(x_1,\ldots,x_n) = 0 \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Introducing the notations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} =\left(&lt;br /&gt;
    \begin{array}{l}&lt;br /&gt;
    x_1 \\&lt;br /&gt;
    \vdots \\&lt;br /&gt;
    x_n &lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf g}({\bf x}) =\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
f_1(x_1,\ldots,x_n) \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
f_n(x_1,\ldots,x_n) = 0 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this can be rewritten as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf g}({\bf x}) ={\bf 0}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solving of this system of non-linear equations is equivalent with minimization problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{\bf x} {\bf F}({\bf x}) = \arg \min_{\bf x}\frac{1}{2}{\bf g}^T({\bf x}) {\bf g}({\bf x}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since the square of each element in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}({\bf x})&amp;lt;/math&amp;gt; is non-negative. The gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}({\bf x}&amp;lt;/math&amp;gt; can be expressed as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}} {\bf F}({\bf x}) = \nabla_{{\bf x}}\left( \frac{1}{2}{\bf g}^T({\bf x}) {\bf g}({\bf x}) \right) = {\bf J}_{{\bf g}}^T({\bf x}){\bf g}({\bf x}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf J}_{{\bf g}}^T({\bf x})&amp;lt;/math&amp;gt; is the Jacobian matrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}({\bf x})&amp;lt;/math&amp;gt;. Then the minimization problem can be solved numerically by applying the gradient descent algorithm. This can be executed by initializing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{0} = {\bf 0}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and performing the iterative steps&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}- \gamma_k {\bf J}_{{\bf g}}^T({\bf x}_{k}){\bf g}({\bf x}_{k}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; is the step size and can be determined by any of the line search methods (see in [[#sssec:grad_meth|3.2.3]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;numeric-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Numeric optimization  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;sssec:grad_meth&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Gradient methods ===&lt;br /&gt;
&lt;br /&gt;
The gradient methods are numeric methods for unconstrained mathematical optimization. They can be applied to differentiable multivariate functions. They are usually formulated as finding the minimum of a multivariate function. All of them use the gradient of the multivariate function, this explains the name.&lt;br /&gt;
&lt;br /&gt;
The basic idea of gradient methods is to decrease the function value in each step of the algorithm. It is well known that at the given point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x_0} \in \mathbb{R}^N&amp;lt;/math&amp;gt; of the multivariate function, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(&amp;lt;/math&amp;gt;&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;):\mathbb{R}^N \rightarrow \mathbb{R}&amp;lt;/math&amp;gt;, the infinitesimal difference in the function value is the highest in the direction of the gradient at that point, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt;. Therefore the steepest decent is in the opposite direction of the gradient. The iterative step of any gradient methods takes a step in a direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; which is related to the negative gradient at the current point, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;- \nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt;. The step size is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt;. Hence the iterative step of any gradient methods can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1}= {\bf x}_{k} + \gamma_k {\bf d}_k.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; and the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; can depend on the iteration step.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Requirements and conditions to decrease the function value in each iteration&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decrease the function value in each step, two requirements must be made.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.1}&amp;lt;/math&amp;gt; It must be ensured that the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; infinitesimally shows into a descent direction.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; The step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; must be enough small to avoid overshooting the nearest local minimum and thus to avoid leading to divergence.&lt;br /&gt;
&lt;br /&gt;
The first requirement is equivalent with showing that the negative gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;- \nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; and vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; lie on the same side of the hyperplane being perpendicular to the gradient. In this case their scalar product is positive. This leads to the condition &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C.1}&amp;lt;/math&amp;gt; ensuring &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.1}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf C.1} \mathrm{~~~~} \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k &amp;lt; 0  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second requirement can be fulfilled by formalising &amp;amp;quot;enough small&amp;amp;quot; by specifying a demanded amount of decrease in function value. This is done by the Armijo condition demanding that the decrease in function value should be at least proportional to the product of the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; and the directional derivative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k&amp;lt;/math&amp;gt;. Hence the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; can be fulfilled by condition &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C.2}&amp;lt;/math&amp;gt;, which is the Armijo condition and given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf C.2} \mathrm{~~}\mathrm{~~Armijo~condition~~} f({\bf x}_k + \gamma_k  {\bf d}_k) - f({\bf x}_k)  \leq  \delta \gamma_k \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k \mathrm{~~~~~~~~~~~~~~~},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; is the constant of proportionality. In the practice usually &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; is set to small values, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;10^{-4}&amp;lt;/math&amp;gt;. Observe that on both sides of this inequality there are negative values.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determination of the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the step size were set to too small then the convergence would become too slow. This leads to a third requirement as&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt; The step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; must be enough large to avoid slowing the convergence. The requirements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt; together ensure an optimal step size.&lt;br /&gt;
&lt;br /&gt;
The three most important search methods for determining the optimal step size are&lt;br /&gt;
&lt;br /&gt;
* Exact line search&lt;br /&gt;
* Inexact line search&lt;br /&gt;
* Backtracing line search&lt;br /&gt;
&lt;br /&gt;
The exact line search determines the optimal step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; by minimizing the function value after taking the next step. This leads to a one-dimensional minimization problem as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{\gamma_k} g(\gamma_k) = \arg \min_{\gamma_k} f({\bf x}_k + \gamma_k  {\bf d}_k).&amp;lt;/math&amp;gt; The exact line search are used only seldom in practice due to its high computing effort.&lt;br /&gt;
&lt;br /&gt;
In the inexact line search the step size, starting from an initial value, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, is iteratively decreased until the function value after the step will be less than the current one, in other words until &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f({\bf x}_{k+1}) = f({\bf x}_k + \gamma_k  {\bf d}_k) &amp;lt;  f({\bf x}_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The backtracing line search searches for &amp;amp;quot;enough small&amp;amp;quot; step size by utilizing the Armijo condition. Starting from an initial step size, the step size is iteratively multiplied by a properly selected constant of proportionality, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; until the Armijo condition fulfils.&lt;br /&gt;
&lt;br /&gt;
While exact line search fulfils both requirements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt;, inexact line search fulfils only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and backtracing line search lies somewhere in between. Because of this and its simplicity, it is often used in the practice.&lt;br /&gt;
&lt;br /&gt;
The pseudo-code of an algorithm for gradient method with backtracing line search can be seen in Algorithm 9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 9 Gradient method - with backtracing line search&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Compute vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
   —– Backtracing line search - begin —&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Init backtracing line search &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k=1&amp;lt;/math&amp;gt;, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0 &amp;lt; \delta &amp;lt; 1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_k + \gamma_k  {\bf d}_k) - f({\bf x}_k) &amp;gt;  \delta \gamma_k \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k = \delta \gamma_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
9    end&amp;lt;br /&amp;gt;&lt;br /&gt;
   —– Backtracing line search - end —-&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  + \gamma_k {\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11   end&amp;lt;br /&amp;gt;&lt;br /&gt;
12   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The gradient descent&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient descent algorithm is a special case of the gradient methods by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; to be the steepest descent, in other words &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt;. Thus gradient descent is a first-order method and its iterative step can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1}= {\bf x}_{k} - \gamma_k \nabla_{{\bf x}}f({\bf x}_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the context of deep learning the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is also called as learning rate. The pseudo-code of the gradient descent algorithm is given in Algorithm 10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 10 Gradient descent algorithm&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Update learning rate by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  - \gamma_k \nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    end&amp;lt;br /&amp;gt;&lt;br /&gt;
8    return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The convergence to local minimum can be guaranteed under certain assumptions on function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; and specific choice s of the dependency of learning rate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; on &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_k&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k-1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_k)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k-1})&amp;lt;/math&amp;gt;. If function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; is convex, then local minimum is also the global minimum.&lt;br /&gt;
&lt;br /&gt;
The extension of gradient descent, the stochastic gradient descent algorithm and its improved variants are the most commonly used numeric optimization algorithms for training deep neural networks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Further special cases of gradient methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several further algorithm can be obtained as special cases of gradient methods by setting vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; specially. These includes&lt;br /&gt;
&lt;br /&gt;
* Diagonal scaled gradient descent and&lt;br /&gt;
* Newton’s method.&lt;br /&gt;
&lt;br /&gt;
The diagonal scaled gradient descent algorithm is obtained by setting&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -{\bf D}\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;={\bf D}= diag(d_1,\ldots,d_L)&amp;lt;/math&amp;gt; is a diagonal matrix. Note that just like vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt;, matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; can also depend on the iteration step.&lt;br /&gt;
&lt;br /&gt;
The Newton’s method, also called as Newton–Raphson method applied to optimization can be also obtained by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -{\bf D}\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = {\bf H}_f^{-1}&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}_f^{-1}= \nabla_{{\bf x}}^2 f({\bf x})&amp;lt;/math&amp;gt; is the Hessian matrix. Since the Hessian matrix includes second order derivatives of function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;, Newton’s method is a second order optimization method. For the class of convex functions the Newton’s method converges to the minimum quadratically fast.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;second-order-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Second-order algorithms ===&lt;br /&gt;
&lt;br /&gt;
The second-order algorithms use the second order information in their original formulation from the Hessian matrix. The following second-order methods are considered&lt;br /&gt;
&lt;br /&gt;
* Newton’s method&lt;br /&gt;
* Quasi-Newton methods&lt;br /&gt;
* Non-linear conjugate gradient algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Newton methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Newton’s method for local optimization is based on the second order Taylor-expansion of the function to be optimized. We apply it to minimize the function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;. The second order Taylor-expansion of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; around &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k}&amp;lt;/math&amp;gt; is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f({\boldsymbol{x}}) \approx f({\bf x}_{k}) + ({\bf x} - {\bf x}_{k})^T \nabla_{{\bf x}}f({\bf x}_{k}) + \frac{1}{2}({\bf x} - {\bf x}_{k})^T  {\bf H}_f({\bf x}_{k}) ({\bf x} - {\bf x}_{k}).&amp;lt;/math&amp;gt; The method chooses the next value of the parameter vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; as the minimum of the above Taylor-expansion form. It is well known that the necessary condition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; being the minimum is that the gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; must be &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf 0}&amp;lt;/math&amp;gt;. Computing the gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; with respect to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; and setting it to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf 0}&amp;lt;/math&amp;gt; gives &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}) = \nabla_{{\bf x}}f({\bf x}_{k}) + {\bf H}_f({\bf x}_{k}) ({\bf x} - {\bf x}_{k}) = {\bf 0},&amp;lt;/math&amp;gt; from which the next value of the parameter vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; can be expressed by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} = {\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k} - {\bf H}_f^{-1}({\bf x}_{k})\nabla_{{\bf x}}f({\bf x}_{k}),&amp;lt;/math&amp;gt; which is the same formula as we got by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = {\bf H}_f^{-1}&amp;lt;/math&amp;gt; in the general iteration relation of the gradient methods. This recursive computational rule utilizes also the second order information in Hessian matrix. If the function to be minimized is locally quadratic then the method jumps in one step to the minimum. Otherwise it iterates in quadratic steps and hence faster than the gradient descent. There are two major issues with the Newton’s method as&lt;br /&gt;
&lt;br /&gt;
# Limitation - The convergence of the method is ensured only for locally convex regions. It can move in wrong direction near a saddle point.&lt;br /&gt;
# Drawback - The numerical complexity of the method is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^3)&amp;lt;/math&amp;gt;, that is higher than that of the first-order methods. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of parameters, i.e. the size of vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt;. This is due to the computation of the inverse Hessian in each iteration step.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quasi-Newton methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In many applications, like e.g. in machine learning and in deep learning trainings, the the number of parameters, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is usually in magnitude of thousands and millions. Therefore Newton’s method can not be applied directly due to its numerical complexity in such applications.&lt;br /&gt;
&lt;br /&gt;
Instead the quasi-Newton methods can be applied, in which the Hessian matrix is approximated by the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, which needs much less computation effort. The matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; is chosen to satisfy the so called secant equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}) = \nabla_{{\bf x}}f({\bf x}_{k}) + {\bf B}({\bf x}_{k}) ({\bf x} - {\bf x}_{k}),&amp;lt;/math&amp;gt; This leads to a significant reduction in the computational complexity.&lt;br /&gt;
&lt;br /&gt;
The most prominent quasi-Newton method is the&amp;lt;br /&amp;gt;&lt;br /&gt;
Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm. It uses the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; only for determining the search direction, but it does not apply the quadratic step size like in the original Newton’s method. Instead a line search is performed. If the function is not convex then the step size is determined by finding a point satisfying the [https://en.wikipedia.org/wiki/Wolfe_conditions Wolfe conditions]. The numerical complexity of the BFGS algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^2)&amp;lt;/math&amp;gt;. However the algorithm stores the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; in each iteration step leading to the memory need &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^2)&amp;lt;/math&amp;gt;. This makes it not appropriate for using in DL.&lt;br /&gt;
&lt;br /&gt;
A further improvement of BFGS is the Limited Memory BFGS (L-BFGS), whose memory need is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(1)&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N)&amp;lt;/math&amp;gt; depending on the amount of information used from previous iteration at updating matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;. The method converges faster in locally convex environment than in a non-convex one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Non-linear conjugate gradient algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One potential problem of gradient descent algorithm, that in narrow valley it takes a zig-zag route, which slows the convergence. This is because the consecutive gradients are orthogonal and therefore some part of progress already achieved in the previous gradient direction will be undo.&amp;lt;br /&amp;gt;&lt;br /&gt;
The conjugate gradient algorithm overcomes this problem by selecting the consecutive directions being so called conjugate gradient directions. In case of N-dimensional quadratic function it reaches the minimum exactly after &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; steps, since it does not undo progress made in previous directions. The next direction is determined as the linear combination of the actual gradient and the actual direction, in which the previous direction is weighted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;. Since the next and actual directions are conjugate gradients, the next direction can be determined on straightforward way by the help of the eigenvectors of the Hessian of the multivariate function to be minimized. The conjugate gradient algorithm was intended to solve a quadratic minimization problem, which is equivalent with solving a system of linear equations.&lt;br /&gt;
&lt;br /&gt;
The non-linear conjugate gradient algorithm is a generalization of the conjugate gradient algorithm to find a minimum of any non-linear multivariate function. In this case the algorithm does not stop after &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; steps, so a small modification is required in order to restart search eventually in the direction of unaltered gradient. This is performed by periodic reset of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. In case of large &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;, which is the case of e.g. in training deep learning models, the computation of the Hessian matrix requires a high computational effort. Therefore computationally more efficient ways were proposed to compute parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;. Two of the best known formulas for computing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; are given as follows:&lt;br /&gt;
&lt;br /&gt;
* Fletcher-Reeves formula: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\beta_k^{FR} = \frac{\nabla_{{\bf x}}^Tf({\bf x}_{k}) \nabla_{{\bf x}}f({\bf x}_{k})}{\nabla_{{\bf x}}^Tf({\bf x}_{k-1}) \nabla_{{\bf x}}f({\bf x}_{k-1})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polak-Ribiere formula: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\beta_k^{PR} = \frac{\nabla_{{\bf x}}^Tf({\bf x}_{k}) \left(\nabla_{{\bf x}}f({\bf x}_{k})- \nabla_{{\bf x}}f({\bf x}_{k-1})\right)}{\nabla_{{\bf x}}^Tf({\bf x}_{k-1}) \nabla_{{\bf x}}f({\bf x}_{k-1})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pseudo-code of the algorithm is given in Algorithm 11.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 11 Non-linear conjugate gradient algorithm&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize conjugate direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf s}_{-1} ={\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Update conjugate direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf s}_k = -\nabla_{{\bf x}}f({\bf x}_k) + \beta_k {\bf s}_{k-1}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Perform line search &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k = \arg\min_{\gamma} f({\bf x}_k + \gamma {\bf s}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  + \gamma_k {\bf s}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
9 end&amp;lt;br /&amp;gt;&lt;br /&gt;
10 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Quasi-Newton methods converge potentially much faster than the non-linear conjugate gradient algorithm.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Konigsberg_bridges_2L.png&amp;diff=6547</id>
		<title>Datei:Konigsberg bridges 2L.png</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Konigsberg_bridges_2L.png&amp;diff=6547"/>
		<updated>2025-03-13T20:41:28Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6546</id>
		<title>Graph Theory and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6546"/>
		<updated>2025-03-13T20:37:17Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;graph-theory-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Graph Theory and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on graph theory the reader is referred to the book [Gross and Yellen(1998)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;seven-bridges-of-königsberg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Seven Bridges of Königsberg ==&lt;br /&gt;
&lt;br /&gt;
Seven Bridges of Königsberg is a problem of mathematics formulated by Leonhard Euler after a walk in Königsberg in Prussia (now Kaliningrad, Russia). The islands were connected to each other and the mainlands on the two sides of the Pregel River via seven bridges (see Figure [[#fig:Königsberg_bridges|2]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Königsberg_bridges&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Konigsberg_bridges_2L.png|460px|thumb|center|Figure 2: Map of Königsberg with the seven bridges in the 18-th century (Source: By Bogdan Giuşcă - Public domain (PD),based on the image, CC BY-SA 3.0, \url{https://commons.wikimedia.org/w/index.php?curid=112920})]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The problem is to find a walk path that would cross each of the seven bridges only once.&lt;br /&gt;
&lt;br /&gt;
Leonhard Euler has resolved the problem in 1736 by showing that such a walk path does not exist. His solution founded the graph theory and therefore the Seven Bridges of Königsberg problem is considered to be the first problem of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graphs-theory-basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Graphs theory basics ==&lt;br /&gt;
&lt;br /&gt;
A graph is a mathematical object consisting of vertices (nodes) and edges connecting pairs of vertices, see example in Figure [[#fig:exa_undirected_graph|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_undirected_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_undirected_graph.jpg|460px|thumb|center|Figure 3: Example of an undirected graph]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Graph theory studies properties of graphs and problems which can be described by means of graphs. Graph theoretical algorithms and results are applied in many areas, like e.g. transport networks, computer science or biology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basics ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Basic terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A graph is composed of vertices (nodes) and edges connecting pairs of vertices. Vertex and edge are the two basic units of the graph. The set of vertices and edges is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{V}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;, respectively. In undirected graph the edges have no direction, they simple connect two vertices. The graph shown in Figure [[#fig:exa_undirected_graph|3]] is an example of an undirected graph.&lt;br /&gt;
&lt;br /&gt;
The degree of a vertex is the number of edges connected to it. A path is an uninterrupted line connecting two vertices over sequence of edges and vertices. For example the path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,5,6)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] connects the vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;. This way a path is specified by an ordered list of all vertices locating on the uninterrupted line going from the starting vertex of the path to the end vertex of it. A cycle is a path, whose start vertex and end vertex is the same. For example &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,3,4,1)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] is a cycle. A graph is called connected graph, if there is a path between any two vertices of the graph. For example the graph in Figure [[#fig:exa_undirected_graph|3]] is a connected graph.&lt;br /&gt;
&lt;br /&gt;
In the weighted graph each edge has a weight (or cost) associated to them. This weight can represent different physical properties, like e.g. distance between two nodes, capacity of a network link, transport cost of a way between two nodes, etc. An example of a weighted graph can be seen in Figure [[#fig:exa_weighted_graph|4]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_weighted_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_weighted_graph.jpg|460px|thumb|center|Figure 4: Example of a weighted graph]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Types of graphs&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The classification of graphs into various types is based on the properties of the considered subclass of graphs. The most important types of graphs together with their definitions are given as follows.&lt;br /&gt;
&lt;br /&gt;
* Undirected graph - A graph with edges having no direction.&lt;br /&gt;
* Directed graph - A graph with edges having direction.&lt;br /&gt;
* Unweighted graph - A graph with edges having no weights associated to them.&lt;br /&gt;
* Weighted graph - A graph with edges having weights associated to them.&lt;br /&gt;
* Connected graph - A graph having path between any two of its vertices.&lt;br /&gt;
* Disconnected graph - A graph containing at least one pair of vertices having no path between them.&lt;br /&gt;
* Cyclic graph - A graph containing at least one cycle.&lt;br /&gt;
* Acyclic graph - A graph does not containing any cycles.&lt;br /&gt;
* Tree - A connected acyclic graph.&lt;br /&gt;
* Multi-graph - A graph containing at least one pair of vertices having multiple edges between them.&lt;br /&gt;
* Simple graph - A graph without cycles and multiple edges between the same pair of vertices.&lt;br /&gt;
* Complete graph - A graph in which each pair of vertices is connected by edge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Graph descriptions&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most often used graph representations in algorithms are&lt;br /&gt;
&lt;br /&gt;
* adjacency matrix and&lt;br /&gt;
* adjacency list,&lt;br /&gt;
&lt;br /&gt;
because they enable the mathematical description of graphs by means of programming variables, like matrix, array and list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency matrix&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adjacency matrix is suitable to describe unweighted graphs, both undirected and directed ones. Adjacency matrix is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V \times V&amp;lt;/math&amp;gt; matrix, whose &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element describes the existence of the connection from vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; as a binary value. If there is a connection then this value equals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. For example the adjacency matrix of the undirected, unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] looks like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left(&lt;br /&gt;
    \begin{array}{llllll}&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&lt;br /&gt;
    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right).&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The construction of the adjacency matrix implies that the adjacency matrix of an undirected graph is always a symmetric matrix. The idea of describing an unweighted graph by constructing an adjacency matrix as 2-dimensional array can be theoretically extended to describe a weighted graph by constructing a 3-dimensional array, in which the third dimension represents the weight assigned to the edge specified by the first two dimensions. Such a 3-dimensional could be called as adjacency tensor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another way of mathematical representation of a graph is the adjacency list. Adjacency list is an array of lists, in which each list specifies a set of neighbours of a vertex assigned to the actual list as index of the array. In describing a weighted graph, the list consists of the comma separated sequence of &amp;amp;quot;ending vertex: weight&amp;amp;quot; pairs, where each such pair specifies an edge to the given ending vertex with the given weight starting from the vertex to which the considered list belongs to. In case of an unweighted graph the list is a comma separated sequence of neighbour vertexes of the vertex to which the considered list belongs to. Therefore this type of representation is suitable to describe both unweighted and weighted graphs. For example the adjacency list of the unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2,4\} \\&lt;br /&gt;
2: &amp;amp; \{1,3,5\}\\&lt;br /&gt;
3: &amp;amp; \{2,4\} \\&lt;br /&gt;
4: &amp;amp; \{1,3,5\} \\&lt;br /&gt;
5: &amp;amp; \{2,4,6\} \\&lt;br /&gt;
6: &amp;amp; \{5\}&lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly the adjacency list of the weighted graph example in Figure [[#fig:exa_weighted_graph|4]] can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2:5,3:2\} \\&lt;br /&gt;
2: &amp;amp; \{1:5,3:3,4:4\}\\&lt;br /&gt;
3: &amp;amp; \{1:2,2:3,4:1\} \\&lt;br /&gt;
4: &amp;amp; \{2:4,3:1,5:3\} \\&lt;br /&gt;
5: &amp;amp; \{1:8,4:3\} &lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Edge list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Still another way of mathematically describing a graph is to specify it as edge list. Each edge is specified by a sequence in the form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[&amp;lt;/math&amp;gt; starting vertex, ending vertex, weight (optional) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;]&amp;lt;/math&amp;gt;. Thus the edge list can be given as a two/three column matrix for unweighted/weighted graphs. Hence this type of representation is suitable to describe both unweighted and weighted graphs. The unweighted graph in Figure [[#fig:exa_undirected_graph|3]] and the weighted graph in Figure [[#fig:exa_weighted_graph|4]] can be described by edge list, respectively, as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2], [2,3], [1,4], [4,5], [2,5], [3,4], [5,6] ]  \\&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2,5], [2,3,3], [3,1,2], [2,4,4], [4,3,1], [1,5,8], [4,5,3] ]. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graph-problems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Graph problems ===&lt;br /&gt;
&lt;br /&gt;
Graph theory can be applied for solving different problems in many areas. Without claim for completeness we list several well-known graph problems with their brief description.&lt;br /&gt;
&lt;br /&gt;
* Graph coloring - Graph coloring is a group of problems all of them having something to do with coloring of graphs. Usually they are specified by means of a restriction on the way of coloring, like e.g no adjacent vertices may have the same color. One of the famous result in graph coloring is the so called [https://en.wikipedia.org/wiki/Four_color_theorem Four-color theorem]&lt;br /&gt;
* Network flow problems - Network flow problems deal with question related to [https://en.wikipedia.org/wiki/Flow_network Flow networks].&lt;br /&gt;
* Covering problems - Covering problems are set cover problems dealing with covering some subsets of vertices/subgraphs. Vertex cover problem is a special case of set cover problems, in which for every edge its starting or end vertex is in the vertex cover.&lt;br /&gt;
* Route problems - Route problems are graph problems, which are all related to find a route specified by various constraints on the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Route problems&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Route problems form an important class of graph problems, since they have applications in many areas. Here is a list of several selected Route problems, which will be discussed in more details in the rest of this section.&lt;br /&gt;
&lt;br /&gt;
# Hamiltonian path and Eulerian path&lt;br /&gt;
# Traveling salesman problem&lt;br /&gt;
# Chinese postman problem (Route inspection problem)&lt;br /&gt;
# Minimum spanning tree&lt;br /&gt;
# Shortest path problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-vertex-cover-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum Vertex Cover Problem  ==&lt;br /&gt;
&lt;br /&gt;
Vertex cover problem is a kind of set cover problems, in which a set of vertices are searched, which includes at least one endpoint of every edge of the graph. The Minimum Vertex Cover Problem (MIN-VC) is a vertex cover problem on undirected graph, in which a set of minimum number of vertices are searched, which includes at least one endpoint of every edge of the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_minvc&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_minvc.jpg|460px|thumb|center|Figure 5: Example graph for MIN-VC problem]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the minimum vertex cover of the example graph in Figure [[#fig:exa_graph_minvc|5]] is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,4\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,4,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{1,3,5\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The MIN-VC is an optimization problem and it can be reformulated to a decision problem, which is also called as &amp;amp;quot;vertex cover problem&amp;amp;quot;. It is known to be [https://en.wikipedia.org/wiki/NP-completeness NP-complete] (nondeterministic polynomial-time complete), so usually so it cannot be solved by a polynomial-time algorithm.&lt;br /&gt;
&lt;br /&gt;
There is an approximate algorithm for determining the minimum vertex cover of an undirected graph. Its schematic representation is shown in Algorithm 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 1 Approximate algorithm for MIN-VC&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph given by an edge list (= set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;).&amp;lt;br /&amp;gt;&lt;br /&gt;
Output : Found set of vertex cover &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise set of vertex cover: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;=&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; is not empty&amp;lt;br /&amp;gt;&lt;br /&gt;
3   Take an arbitrary edge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(u,v)&amp;lt;/math&amp;gt; from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   Remove all edges from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; having endpoint either &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It can be proven that the above approximate algorithm for MIN-VC always finds a vertex cover whose size is not more than twice of the size of the minimum vertex cover. The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;. The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|&amp;lt;/math&amp;gt; The memory is needed to store the visited vertices, i.e. the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-hamiltonian-path&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Eulerian path and Hamiltonian path ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eulerian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. Note that the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted. However this does not affect the mathematical treatment of Eulerian path, therefore we treat these cases commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for for the existence of Eulerian path in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Either none of the vertices or exactly two vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have odd degree and all its other vertices have even degree.&lt;br /&gt;
&lt;br /&gt;
Along the Euler path, each time walking through a vertex we walking through two previously unseen edges: one at approaching the vertex and the other at leaving it. On this way the number of edges at each middle vertex (i.e. the vertices except the starting and ending vertices of the path) must be even. The starting and ending vertices of the path are enabled to have odd degree, as the start or finish of the walk goes through on only one edge connected to that vertices. This argument proves the necessity of the condition. It turns out that the condition is also sufficient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-path&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_E-path.jpg|460px|thumb|center|Figure 6: Example graph with Euler path]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_graph_E-path|6]] has an Euler path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,3,4,5,2,4)&amp;lt;/math&amp;gt;, since only vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree.&lt;br /&gt;
&lt;br /&gt;
An Euler path can be determined by going through the graph starting from a vertex with odd degree and selecting always previously unseen edges at each vertices. The conditions ensure that this always leads to an Euler path. This process requires the logging of the already visited edges at each vertex. It follows that the computational complexity of finding an Euler path is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Seven Bridges of Königsberg is a problem of finding an Euler path. In fact Leonard Euler solved it in 1736 by showing that there is no path that visits every of the seven bridges exactly once. His solution applies the above argument for necessary condition. Euler’s solution of the Königsberg bridge problem is the first theorem of graph theory and laid the foundations of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian cycle in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. Similarly to Eulerian path, the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted, which does not affect of the mathematical treatment of Eulerian cycle. Hence these cases are treated commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. A graph containing a Eulerian cycle is a Eulerian graph.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for the existence of Eulerian cycle in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be formulated as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
This can be argumented similarly as in case of Eulerian path. Because in case of Eulerian cycle the path returns to the starting vertex, no odd degree is allowed yet for that vertex.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_graph_E-path|6]] has no Eulerian cycle, since not every vertices have even degree (vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_E-cycle.jpg|460px|thumb|center|Figure 7: Example graph with Eulerian cycle]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However the in the graph in Figure [[#fig:exa_graph_E-cycle|7]] every vertices have even degree, therefore it has a Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
Finding a Eulerian cycle can be completed on the same way as described for Eulerian path, but the visit can start at any vertex, since all vertices have even degree. Like in case of finding an Eulerian path, finding a Eulerian cycle has a computational complexity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Hamiltonian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. The path have not to return to the starting vertex, i.e. Hamiltonian path is an open path. Finding a Hamiltonian path is in general an NP-complete problem.&lt;br /&gt;
&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_undirected_graph|3]] has more Hamiltonian paths: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(3,2,1,4,5,6)&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,4,3,2,5,6)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* transportation networks (finding optimal routes),&lt;br /&gt;
* circuit design and&lt;br /&gt;
* graph theory research.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle (or Hamiltonian circuit) in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. A graph containing a Hamiltonian cycle is a Hamiltonian graph, otherwise it is non-Hamiltonian graph. Like in case of finding a Hamiltonian path, finding a Hamiltonian cycle is also an NP-complete problem. Finding a Hamiltonian path is often easier than finding a Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_undirected_graph|3]] has no Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_H_cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_H_cycle.jpg|460px|thumb|center|Figure 8: Example graph with Hamiltonian cycle]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However a slightly different graph in Figure [[#fig:exa_graph_H_cycle|8]] has a Hamiltonian cycle: (5,2,1,4,3,5).&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* computer science,&lt;br /&gt;
* logistics and&lt;br /&gt;
* network design.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algorithms for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the next we give a brief description of the following two algorithms for finding Hamiltonian cycle:&lt;br /&gt;
&lt;br /&gt;
* Brute-force search and&lt;br /&gt;
* Backtracing algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Brute-force search - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search (also called exhaustive search) follows a naive approach and tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequences of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Backtracing algorithm - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of Backtracing algorithm is to add iteratively a new vertex to the actual path of subsequence of vertices, which is an adjacent to the last vertex of the actual path and not yet included in that path. After having the path with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices, it is checked whether it composes a cycle or not. If not then change the path by trying systematically all the adjacent vertices at every position in the path backwards, which is called backtracking.&lt;br /&gt;
&lt;br /&gt;
The algorithm can be implemented on elegant way by applying a recursive function call. The pseudo code of the algorithm is given in Algorithm 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 2 Backtracing algorithm - for finding Hamiltonian cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if Hamiltonian cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if Hamiltonian cycle exist&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]&amp;lt;/math&amp;gt;= first vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
3 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Recursive function&amp;lt;br /&amp;gt;&lt;br /&gt;
bool try_next_vertex_and_check_cycle(path_index k)&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: next index in the path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if backtracking or cycle not exists&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k == |\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2   if exists edge between last and first vertices of path&amp;lt;br /&amp;gt;&lt;br /&gt;
3     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
4   else&amp;lt;br /&amp;gt;&lt;br /&gt;
5     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v \in \mathcal{V}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is adjacent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k-1]&amp;lt;/math&amp;gt; (=last vertex in path)&amp;lt;br /&amp;gt;&lt;br /&gt;
9    and&amp;lt;br /&amp;gt;&lt;br /&gt;
10  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is not yet in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11    path[k]=v&amp;lt;br /&amp;gt;&lt;br /&gt;
12    if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(k+1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13      return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14    end&amp;lt;br /&amp;gt;&lt;br /&gt;
15    (Backtracking - remove v from path)&amp;lt;br /&amp;gt;&lt;br /&gt;
16    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k] = -1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
17  end&amp;lt;br /&amp;gt;&lt;br /&gt;
18 end&amp;lt;br /&amp;gt;&lt;br /&gt;
19 return false (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the course of backtracking every neighbours of every vertices can be tried by the algorithm. Therefore its computational complexity is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;chinese-postman-problem-route-inspection-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Chinese postman problem (Route inspection problem) ==&lt;br /&gt;
&lt;br /&gt;
The Chinese postman problem (also called as route inspection problem) is an extension of finding Eulerian cycle in connected and (unweighted or weighted) undirected graphs. The Chinese postman problem is to find shortest path that visits every edge of the connected and undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; at least once and return to the starting vertex. So the problem is defined on connected graph. The shortest path is defined as the one with minimum number of edges for unweighted graph and as the path with minimum accumulated weights for weighted graph. The solution path of Chinese postman problem is called Chinese postman tour. The Chinese postman problem can be solved in polynomial time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; contains an Eulerian cycle, then it is also the solution for the Chinese postman problem, since Eulerian cycle has the shortest path (minimum number of edges in unweighted graph and minimum accumulated weights in weighted graph) due to the necessity of visiting all edges at least once.&lt;br /&gt;
&lt;br /&gt;
Therefore the necessary and sufficient condition for the solution for the Chinese postman problem to be the Eulerian cycle is the existence of Eulerian cycle, which can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
For example graph in Figure [[#fig:exa_graph_E-cycle|7]] the solution, i.e the Chinese postman tour is the Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-non-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Non-Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; has no Eulerian cycle, then the graph must be extended to become Eulerian. This is done by duplicating some edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; connected to vertices with odd degree in order to change the degree of all these vertices become to even. The edges to be duplicated must be selected from the relevant ones (i.e. connected to vertices with odd degree) on that way, that the increase of the path length due to edge duplication must be the possible smallest. Therefore those pairing of the vertices with odd degree are selected, which have the shortest path connecting them.&lt;br /&gt;
&lt;br /&gt;
The example unweighted graph in Figure [[#fig:exa_graph_cpp_unweighted|9]] shows a Non-Eulerian graph and the Chinese postman tour obtained by duplicating the edges [2,4] and [3,1].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_unweighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_cpp_unweighted.jpg|460px|thumb|center|Figure 9: Example Non-Eulerian unweighted graph with Chinese postman tour]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Similarly the example Non-Eulerian weighted graph in Figure [[#fig:exa_graph_cpp_weighted|10]] illustrates the construction of the Chinese postman by duplicating the edges [2,4], [4,6] and [5,1]. Here duplicating [2,4] together with [4,6] instead of [2,6] inserts shorter path (i.e. accumulated weight 2+1= 3 instead of 5). Similarly duplicating [5,1] instead of [5,3] together with [3,1] inserts shorter path (i.e. accumulated weight 1 instead of 1+2=3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_weighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_cpp_weighted.jpg|460px|thumb|center|Figure 10: Example Non-Eulerian weighted graph with Chinese postman tour]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithm-for-chinese-postman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithm for Chinese postman problem ===&lt;br /&gt;
&lt;br /&gt;
Based on the above considerations the algorithm for finding the Chinese postman route can be given schematically by means of its steps in Algorithm 3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 3 Algorithm for Chinese postman problem&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Chinese postman route.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if grap &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is Eulerian&amp;lt;br /&amp;gt;&lt;br /&gt;
2    Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    return Eulerian cycle and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Find all vertices with odd degree and store in array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;oddVertices&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Construct the complete graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt; from odd vertices together with edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt;representing shortest paths among any pairs of odd vertices&amp;lt;br /&amp;gt;&lt;br /&gt;
9    Find minimum weight perfect matching in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt;, i.e the set of edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; reaching every odd vertices and together having smallest sum of weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; This set of edges is called minimum T-join.&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Extend the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; by adding all edges from minimum T-join&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; resulting in extended graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
12   Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14   return Eulerian cycle of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The numerical complexity of the above minimum T-join based algorithm for solving the Chinese postman problem is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, since both setting up the complete graph, and finding minimum weight perfect matching in it takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt; computational steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-spanning-tree---kruskals-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum spanning tree - Kruskal’s algorithm ==&lt;br /&gt;
&lt;br /&gt;
A spanning tree of a graph is a tree including every vertices of the graph. The number of edges of a spanning tree is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt;, since the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt;-th edge would introduce a cycle and it were not any more a tree.&lt;br /&gt;
&lt;br /&gt;
The minimum spanning tree (MST) is defined for a weighted, undirected, connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;, as a spanning tree with the minimal accumulated weights.&lt;br /&gt;
&lt;br /&gt;
Kruskal’s algorithm can be used to determine the MST of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. In the Kruskal’s algorithm all edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; are sorted according to their weights in increasing order. Then the algorithm iteratively adds the next edge from the sorted list, i.e. the edge with the smallest weight, together with their vertexes to MST, if the newly added edge does not induce a cycle. The algorithm proceeds until every edge on the list is checked. On this way the resulted graph will have &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt; edge, so it will be a spanning tree and the way of constructing implies that it will have the least accumulated weights.&lt;br /&gt;
&lt;br /&gt;
The algorithm takes in each step the locally optimal decision due to adding the edge with the smallest weight among the still available ones. Therefore Kruskal’s algorithm is a greedy algorithm.&lt;br /&gt;
&lt;br /&gt;
The algorithm is shown schematically in Algorithm 4.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 4 Kruskal’s algorithm for detrmining MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: MST of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise graph MST to be set empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Sort every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; in increasing weight order and insert them,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; together with their vertexes into array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=0,\ldots size(sortedListEdges)-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    if inserting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST does not induce a cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
5      Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST&amp;lt;br /&amp;gt;&lt;br /&gt;
6    end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt;, since sorting the edges has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; complexity, iterating through every edges and checking cycle has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|) =\mathcal{O}(log(|\mathcal{E}|)&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{E}|&amp;lt;/math&amp;gt; is at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;, which is needed to store edges together with their vertexes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;traveling-salesman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Traveling salesman problem ==&lt;br /&gt;
&lt;br /&gt;
The Traveling Salesman Problem (TSP) originates from a context of cities and given distances among them. TSP is to look for the shortest path that goes through each city exactly once and returns to the starting city. Usually there exists a route between any pair of cities with some given distance. In graph theory context an equivalent formulation of TSP can be given as looking for a path with the least accumulated weights in a weighted, often complete graph, that goes through each vertex exactly once and returns to the starting vertex. This is equivalent with finding the Hamiltonian cycle with the minimum accumulated weight in a weighted, often complete graph. Thus the TSP is more general than Hamilton cycle problem and hence Hamilton cycle problem is a special case of TSP. The resulted path can be also called as TSP path.&lt;br /&gt;
&lt;br /&gt;
The TSP was formulated mathematically in the 19th century and was first studied mathematically in the 1930s. The decision problem version of TSP is an NP-complete problem, so TSP is NP-hard. TSP is one of the most intensively investigated problem in combinatorial optimization, since it is used as benchmark for other optimization methods in terms of computational complexity.&lt;br /&gt;
&lt;br /&gt;
Some properties of TSP can be provided as&lt;br /&gt;
&lt;br /&gt;
* Symmetric and asymmetric TSP. In symmetric TSP the distance between two cities is the same in both direction, which leads to a formulation in graph theory context to a TSP on undirected graph. In asymmetric TSP either do not exist a path between two cities in both direction or the distances are different excluding the higher one from the TSP formulation. In these cases the formulation in graph theory context yileds a TSP on directed graph.&lt;br /&gt;
* Completing the graph by adding edges with sufficiently long distances will not affect the optimal path.&lt;br /&gt;
* The path to be a cycle or an open path does not make difference in the computational complexity of TSP (like in case of Hamilton path problem).&lt;br /&gt;
&lt;br /&gt;
The TSP has applications in numerous fields, like logistics, route planning in transport networks, manufacturing of microchips and DNA sequencing. One-way streets, airfares with different departure and arrival fees are real-world scenarios for applying asymmetric TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;generalizations-of-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Generalizations of TSP ===&lt;br /&gt;
&lt;br /&gt;
Several generalizations of TSP are listed below.&lt;br /&gt;
&lt;br /&gt;
* The travelling politician problem (also called as &amp;amp;quot;generalized travelling salesman problem&amp;amp;quot;) has a context with states having one or more cities and the travelling man must visit exactly one city from each state. It has been shown that travelling politician problem can be led back to standard TSP with modified distance matrix.&lt;br /&gt;
* The travelling purchaser problem has a purchaser, who has to buy a set of products, which can be bought in more cities but at different prices. The optimization objective is to find a path among a subset of cities that enables to buy all the products with minimal total cost (=taveling cost + purchasing cost).&lt;br /&gt;
* Vehicle routing problem.&lt;br /&gt;
* Ring star problem ([Labbé et al.(2004)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;integer-linear-programming-formulation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Integer linear programming formulation ===&lt;br /&gt;
&lt;br /&gt;
In order to form the TSP as Integer Linear Programming (ILP) optimization, several variables must be introduced. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; denote the number of cities (vertices), i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N = |\mathcal{V}|&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_{ij}&amp;lt;/math&amp;gt; stand for the distances (weights) between the cities (vertices) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}&amp;lt;/math&amp;gt; be a decision variable describing whether the path goes from city (vertix) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, or not for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;x_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~path~goes~i \rightarrow j}  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~~~~~~~~~~~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\}.&amp;lt;/math&amp;gt; The integer nature of the values &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; makes this optimization problem an ILP. The objective function of the optimization task is to minimize the path length (= accumulated weights), in other word&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij} ~j = 1, \ldots, N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However without further constraints this optimization considers not only paths, which are characterized by also leaving each reached vertex, but all set of edges enabling the minimum being at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j \in \mathcal{V}&amp;lt;/math&amp;gt;. Therefore further constraints are necessary to ensure that paths are considered and each vertex is visited exactly once. These requirements can be forced by formulating the following further two constraints, which force that the path reaches each vertex exactly once and leaves each vertex exactly once &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N, \\&lt;br /&gt;
\sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constraints ensure that the selected way looks locally as path and all vertices are visited, but still allow that the selected set of edges comprises several local paths each of them visiting only a disjunct subset of vertices instead of one global path visiting every vertices. This global path requirement makes TSP a difficult problem. There are more ways to formulate this global path requirement as a linear constraint. The Miller-Tucker-Zemlin formulation introduces dummy variables &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; for keeping track the order of visit the city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 1, \ldots, N&amp;lt;/math&amp;gt;. The path starts with visiting city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. The global path requirement is ensured by forcing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; being higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; is visited before city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 2, \ldots, N&amp;lt;/math&amp;gt;. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; must be higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; at least by one when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; locates on the path after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, and otherwise by a values less than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; to ensure that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; does not force an unwanted relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt;. Since city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is left out from these constraint, it ensures that the optimal path must return to city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise the value of the dummy variable of the city visited after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N-1&amp;lt;/math&amp;gt; would be less that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_{N-1}&amp;lt;/math&amp;gt;, which would violate the constraint. The city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is the only one for which a decrease in value of the dummy variable allowed when the path reaches city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. These considerations lead to the formulation of the global path requirement as a linear constraint as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting all these together gives the Miller-Tucker-Zemlin ILP formulation of the TSP as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij},~\ldots, N, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~subject~to} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}1.~~~ \sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N,  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}2.~~~ \sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N,  \mathrm{~and~} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\ &lt;br /&gt;
\mathrm{~constraint~}3.~~~ u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithms-for-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithms for TSP ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Exact algorithm - Brute-force search&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices and selects the one with the lowest accumulated weights. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequence of vertices the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;. Hence this approach becomes intractable already for number of cities in the magnitude of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;20&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Approximate algorithms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the NP-completeness of the TSP the exact solution becomes intractable very fast as the number of cities increases. Therefore there is a need for establishing approximate algorithms for the TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Nearest neighbour algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nearest Neighbour (NN) algorithm selects the nearest not yet visited neighbour city at each step. Thus its decision is locally optimal in each step, therefore it is a greedy algorithm. Its schematic representation is shown in Algorithm 5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 5 Nearest neighbour approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Hamiltonian cycle with minimum accumulated weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]=1&amp;lt;/math&amp;gt; and set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array =sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=1,\ldots N-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Select nearest not yet visited city among neighbours of city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v-1]&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v]=u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight += weight(path[v-1], u)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the NN algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|)&amp;lt;/math&amp;gt;. For city arrangement distributed randomly on the plane, the NN algorithms gives a path which is only 25% longer than the shortest one. However for specific city arrangements the NN algorithm can produce also the worst route.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Christofides algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heuristic approach of Christofides is based on using graph theoretical results to compose an approximate algorithm. It utilizes that a TSP path can not be longer than an Eulerian path over all cities of the graph. Therefore first a subgraph including all cities must be found, than it is extended to be an Eulerian graph, afterwards the Eulerian path is determined in the Eulerian graph and finally it is converted to a TSP path (i.e. to visit each city only once). If the minimum spanning tree of the original graph is selected as first graph and it is made to be an Eulerian graph by doubling every edge in it, then the total length of an Eulerian path can not be more than twice the one of the TSP path. Note that the length of the path changes also at converting the Eulerian path to a TSP path. During this step, shortcut is created for each city visited twice by inserting an edge from the city before this to a city after this. On this way one can approximate a solution for the TSP. The steps of the Christofides algorithm are shown schematically in Algorithm 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 6 Christofides approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Duplicate every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; to create an Eulerian graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find an Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Christofides algorithm was one of the first approximation algorithm, which shown that establishing an approximation algorithms can be practically usable approach for solving exactly intractable problems.&lt;br /&gt;
&lt;br /&gt;
An improved version of the algorithm is the algorithm of Christofides and Serdyukov, in whic a better way of creating an Eulerian graph is applied. This is done by applying the so called minimum weight matching. The steps of the algorithm of Christofides and Serdyukov can be seen schematically in Algorithm 7.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 7 Approximate algorithm of Christofides and Serdyukov for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Apply minimum weight matching to odd-degree vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; giving graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find optimal Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Approximate algorithm of Christofides and Serdyukov gives an approximate TSP path with accumulated weights, which is at most 1,5 times higher than the one of the optimal TSP path. The computational complexity of the approximate algorithm of Christofides and Serdyukov is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, which is mainly caused by minimum weight matching algorithm part.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;shortest-path-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Shortest path problem  ==&lt;br /&gt;
&lt;br /&gt;
The shortest path in a weighted graph between two vertices is the path connecting them with the smallest accumulated weight. There are more algorithm for finding shortest path, each with a slightly different applicability scope.&lt;br /&gt;
&lt;br /&gt;
Besides of Diskstra’s algoritm another common algorithms are the [https://en.wikipedia.org/wiki/Bellman-Ford_algorithm Bellman-Ford] and the [https://en.wikipedia.org/wiki/Floyd-Warshall_algorithm Floyd Warshall] algorithms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;dijkstra-algorithmus&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Dijkstra-Algorithmus ===&lt;br /&gt;
&lt;br /&gt;
Diskstra’s algorithm finds the shortest path from a given source vertex to every vertices in a weighted graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. The graph must not contain negative edge, since in that case the algorithm fails.&lt;br /&gt;
&lt;br /&gt;
The idea of Diskstra’s algorithm is an iterative extension of shortest path tree (SPT) containing a subtree with vertices, for which the shortest paths from the a given source have already been found. The vertices outside of SPT have also minimum distance values assigned during the intermediate steps of the processing. The minimum distance values of vertices being neighbour of any vertices of SPT and locating outside of SPT represent the minimum distance from source vertex to the considered vertex via every possible routes over the vertices of the actual SPT. The iterative extension of SPT is performed by selecting the vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with the shortest minimum distance among the vertices locating outside of SPT, adding this vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; together with its minimum distance to SPT and reevaluating the minimum distances of each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; locating outside of the updated SPT and being the neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;. During the reevaluation the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is compared to the sum (minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)) and if the later is smaller then the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; will be updated.&lt;br /&gt;
&lt;br /&gt;
The schematical representation of the algorithm can be seen in Algorithm 8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 8 Dijkstra-Algorithmus for determining SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
- Source vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Array of minimum distances to every vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Create an adjacenty matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; for maintaining SPT with vertices (subtree),&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;for which the shortest paths from the a given source have already been found&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and initialize it to empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; stores already found minimum distance values for its vertices.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Create and adjacency matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; for representing the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being a&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;subgraph of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; containing vertices locating outside of SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and every edges of them. Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; stores also actual values of&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;minimum distance to every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Initialize all these distance values to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt;, and for the source vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;set the minimum distance to the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is not empty (=not all vertices are moved from it)&amp;lt;br /&amp;gt;&lt;br /&gt;
4    take a vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with the smallest minimum distance&amp;lt;br /&amp;gt;&lt;br /&gt;
5    add vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with its minimum distance and its edge connecting it to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
6     matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7      for each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8        (update minimum distance of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; in matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: )&amp;lt;br /&amp;gt;&lt;br /&gt;
9        if minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;) &amp;amp;lt; minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
10         minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; = minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
11         mark edge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; as edge connecting to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
12       end&amp;lt;br /&amp;gt;&lt;br /&gt;
13     end&amp;lt;br /&amp;gt;&lt;br /&gt;
14     remove the row of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15      (that means also removing vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
16 end&amp;lt;br /&amp;gt;&lt;br /&gt;
17 Build up array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt; from SPT matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
18 return array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt;, since finding the vertex in the subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))&amp;lt;/math&amp;gt; operations, which must be done for every vertices. Note that it is the same as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))= \mathcal{O}(log(|\mathcal{E}|))&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The finding the vertex of subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; with the smallest minimum distance can be implemented by the help of priority queue (or Heap). The standard usage of priority queue would overwrite minimum distance in the inserted pair (minimum distance - vertex) for the same vertex always by the minimum distance of the lastly checked edge to that vertex, which is not necessarily the smallest one among every edges. This can be resolved by inserting more copies of the pair (minimum distance - vertex) for the same vertex, since priority queue will take only the one of them with the smallest value of minimum distance.&lt;br /&gt;
&lt;br /&gt;
Dijkstra’s algorithm assumes that in each intermediate step, the minimum distances of the vertices in SPT, are already the final ones, i.e. the shortest paths from the a given source to the vertices of SPT have already been found. This holds with non- negative weight, since in this case a new path to a vertex in SPT via any vertices of outside of SPT would increase the distance by a sum of non-negative weights which then can not be smaller then the distance marked in SPT as the minimum one. However this is not true in case of existence of negative weight, and thus for graphs with negative weights Dijkstra’s algorithm can return higher distance than than the real minimal one, i.e. wrong result. This is illustrated on the graph in Figure [[#fig:exa_graph_neg_weight|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_neg_weight&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:exa_graph_neg_weight.jpg|460px|thumb|center|Figure 11: Example graph with negative weight]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For this graph Dijkstra’s algorithm would give minimum distance for node &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;, which is wrong, since the right value is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;5&amp;lt;/math&amp;gt;, respectively&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Number_Theory&amp;diff=6545</id>
		<title>Number Theory</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Number_Theory&amp;diff=6545"/>
		<updated>2025-03-13T20:31:01Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;number-theory-and-its-application-to-cryptography-combinatorics-relations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Number Theory and its Application to Cryptography, Combinatorics, Relations =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on number theory the reader is referred to the book [Hardy and Wright(1975)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elementary-number-theory&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Elementary number theory ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prime-factorisation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Prime factorisation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fundamental theorem of arithmetic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Fundamental theorem of arithmetic - in number theory&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Every integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a &amp;gt; 1&amp;lt;/math&amp;gt; is either prime itself or the product of prime numbers, where this product is unique, up to the order of the factors. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a= \prod_{i=1}^{n} p_i^{e_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_i&amp;lt;/math&amp;gt; is the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th prime number arising in the product generating &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i&amp;lt;/math&amp;gt; is its multiplicity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Prime factorisation algorithm&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The prime factorisation is an iterative algorithm to determine the prime factors of a given number. The algorithm is based on the Fundamental theorem of arithmetic. The prime factors are determined by performing iterative division by prime numbers in increasing order.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; Prime factorisation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2520&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
2520 | 2&amp;amp; \\&lt;br /&gt;
1260 | 2&amp;amp; \\&lt;br /&gt;
630 | 2&amp;amp; \\   &lt;br /&gt;
315 | 3&amp;amp; \\&lt;br /&gt;
105 | 3&amp;amp; \\&lt;br /&gt;
35 | 5&amp;amp; \\&lt;br /&gt;
7 | 7&amp;amp; \\&lt;br /&gt;
1 | \mathrm{\ }&amp;amp; \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prime factorisation is believed to be difficult to perform practically for large number since its time complexity is NP, i.e. superpolynomial (= not bounded above by any polynomial).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;congruence&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Congruence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modulo operator&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - modulo operator&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod  m =&amp;lt;/math&amp;gt; the remainder after dividing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
It follows &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a \mod  m = r \equiv a = k*m +r, \mathrm{~where~} 0 &amp;lt;= r &amp;lt; m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Operator identities of modulo operator are given as&lt;br /&gt;
&lt;br /&gt;
# Distributivity - addition &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a+b) \mod  n = [(a \mod  n) + (b \mod  n)] \mod  n&amp;lt;/math&amp;gt;&lt;br /&gt;
# Distributivity - multiplication &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ab \mod  n = [(a \mod  n)*(b \mod  n)] \mod  n&amp;lt;/math&amp;gt;&lt;br /&gt;
# Distributivity - power &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^c \mod  m = (a \mod  m)^c  \mod  m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These identities can be proved directly from the definition of the modulo operator. Due to these three identities one can think in modular arithmetic including only addition, multiplication and power, like in regular integer arithmetic without modulo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Greatest common divisor&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Divisability&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - divisability&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is dividable by a if and only if there exists an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n = a*k&amp;lt;/math&amp;gt;. This is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a|n&amp;lt;/math&amp;gt;. The number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is called the divisor of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Greatest common divisor operator&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - greatest common divisor, gcd() operator&amp;lt;/u&amp;gt; The greatest common division of the integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd(a,b)&amp;lt;/math&amp;gt; is defined by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;gcd(a,b) = \max_i \{d_i \mathrm{~such~that~} d_i|a \mathrm{~and~} d_i|b\}.&amp;lt;/math&amp;gt; An alternative notation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd(a,b)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The operator characteristics of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd()&amp;lt;/math&amp;gt; operator are given by&lt;br /&gt;
&lt;br /&gt;
# Reflexivity: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,b) = (b,a).&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; is neutral element with respect to the operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd()&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,0) = a.&amp;lt;/math&amp;gt;&lt;br /&gt;
# The following relation holds &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,b)=(b, a \mod  b).&amp;lt;/math&amp;gt; Proof.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = d \Rightarrow a=de, b=df \mathrm{~and~} (e,f)=1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e=gf+h&amp;lt;/math&amp;gt; be, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h &amp;lt;f&amp;lt;/math&amp;gt;. It follows that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h) =1&amp;lt;/math&amp;gt;, since otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f&amp;lt;/math&amp;gt; and due to expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; were dividable by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h)&amp;lt;/math&amp;gt; which would lead to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(e,f)&amp;gt;1&amp;lt;/math&amp;gt;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a=de=dgf+dh=gb+dh \Rightarrow a \mod  b = dh \mod  df=dh&amp;lt;/math&amp;gt;, where the last step comes from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h&amp;lt;f&amp;lt;/math&amp;gt;. Thus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(b, a \mod  b) = (b,dh)=(df,dh) = d&amp;lt;/math&amp;gt;, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h) =1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Congruence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - relatively prime (also called as coprime)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; are relatively prime if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)=1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - congruence&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The congruence is a relation and refers to a base number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. The integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; are in congruence relation if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a\mod m) = (b\mod m)&amp;lt;/math&amp;gt; . The congruence id denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b\mod m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b\mod m&amp;lt;/math&amp;gt; implies &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m|(b-a)&amp;lt;/math&amp;gt;. Congruence is an equivalence relation - partitioning the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; disjunct subsets.&lt;br /&gt;
&lt;br /&gt;
Being an equivalence relation, congruence have the following properties: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{CP1.~}\mathrm{~ reflexivity~} a \equiv a\mod  m\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}  \\&lt;br /&gt;
&amp;amp;\mathrm{CP2.~}\mathrm{~ symmetry~}a \equiv b \mod~m \Rightarrow b \equiv a\mod m\\&lt;br /&gt;
&amp;amp;\mathrm{CP3.~}\mathrm{~ transitivity~} a \equiv b\mod m \mathrm{~ and~} b \equiv c\mod m \Rightarrow a \equiv c\mod m \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator identities of the congruence refer to given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b \mod  m&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \equiv d \mod  m&amp;lt;/math&amp;gt; and can be given as&amp;lt;br /&amp;gt;&lt;br /&gt;
CO1. Adding a constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a + \alpha \equiv b + \alpha \mod  m.&amp;lt;/math&amp;gt; CO2. Multiplication by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\alpha*a \equiv \alpha*b \mod  m.\\&lt;br /&gt;
    &amp;amp;\Rightarrow -a \equiv -b \mod  m.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; CO3. Addition of congruences &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a+c \equiv b+d \mod  m.&amp;lt;/math&amp;gt; CO4. Multiplication of congruences &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a*c \equiv b*d \mod  m.&amp;lt;/math&amp;gt; CO5. Division by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\alpha*a \equiv \alpha*b \mod  m \Rightarrow a \equiv b \mod  m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first three identities can be proved directly from the definitions of the modulo and congruence operators. The last identity follows from the general identity for division by constant: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\alpha*a \equiv \alpha*b \mod  m \Leftrightarrow a \equiv b \mod  (m/d),&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\alpha, m) = d&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\alpha*a \equiv \alpha*b \mod  m \Leftrightarrow  m|[\alpha*(b-a)]\Leftrightarrow \\&lt;br /&gt;
&amp;amp;[m/d]|[\alpha/d*(b-a)] \Leftrightarrow  [m/d]|[(b-a)],&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(m/d,\alpha/d)=1&amp;lt;/math&amp;gt;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[m/d]|[(b-a)] \Leftrightarrow  a \equiv b \mod  (m/d)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Congruence class&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; (also called residue class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is any of the disjunct subsets resulted by partitioning the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; by congruence as equivalence relation. In other words congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is a set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{k \in Z \mathrm{~such~that~} k \equiv a \mod m}&amp;lt;/math&amp;gt; for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a =0,\ldots, (m-1)&amp;lt;/math&amp;gt;. For a specific &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; the congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a + m \mathbb{Z}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The set of all congruence classes modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}/m\mathbb{Z}&amp;lt;/math&amp;gt;. Thus the number of elements in this set is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, and this set can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbb{Z}/m\mathbb{Z} = \{0+m\mathbb{Z}, 1+m\mathbb{Z},..., (m-1)+m\mathbb{Z}\}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The set of congruence classes relative prime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;. For any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; representing an element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; holds &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m) = 1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(\mathbb{Z}/10\mathbb{Z})^* = \{1+10\mathbb{Z}, 3+10\mathbb{Z}, 7+10\mathbb{Z}, 9+10\mathbb{Z}\}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If m is prime then number of elements in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; = &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;diophantic-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Diophantic equations ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;euclidean-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Euclidean algorithm ===&lt;br /&gt;
&lt;br /&gt;
The Euclidean algorithm is the standard way of solving the equation of the form &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by=(a,b),&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a,b,x,y \in \mathbb{Z}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Theoretic basics&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Bézout’s identity&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The greatest common divisor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; of two integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; can be represented as a linear sum of the original two numbers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\exists x,y \in \mathbb{Z},  \mathrm{~for~which~} g = (a,b)=ax+by.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Theorem&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The set of all integer linear combinations of the nonzero integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; equals the set of integer muliples of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;, i.e: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a\mathbb{Z}+b\mathbb{Z}=(a,b)\mathbb{Z},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proof:&lt;br /&gt;
&lt;br /&gt;
* Step 1: direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a\mathbb{Z}+b\mathbb{Z} \in (a,b)\mathbb{Z}&amp;lt;/math&amp;gt; - follows from definition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 2: direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)\mathbb{Z} \in a\mathbb{Z}+b\mathbb{Z}&amp;lt;/math&amp;gt; - follows from Bézout’s identity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)=ax+by, \mathrm{~where~} x,y \in \mathbb{Z} \Rightarrow (a,b)\mathbb{Z} = ax\mathbb{Z}+by\mathbb{Z}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary 1&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = n, \mathrm{~where~} a,b,x,y,n \in \mathbb{Z} \mathrm{~and~} a\neq 0, b\neq 0&amp;lt;/math&amp;gt; has a solution if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)|n&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: It follows directly from the above theorem.&amp;lt;br /&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Case 1: If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = 1&amp;lt;/math&amp;gt; then the equation has always a solution.&lt;br /&gt;
* Case 2: If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = d \neq 1&amp;lt;/math&amp;gt; then this case can be fallbacked to Case 1: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;a=de, b=df \mathrm{~and~} (e,f) = 1~(\mathrm{otherwise~} (a,b) &amp;gt; d)\\&lt;br /&gt;
    &amp;amp;dex+dfy=dg,  \mathrm{~then~dividing~by~}d\\&lt;br /&gt;
    &amp;amp;ex+fy=g,  \mathrm{~where~} (e,f) = 1.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary 2&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = (a,b),  \mathrm{~where~} a,b,x,y \in \mathbb{Z}\mathrm{~and~}a\neq0, b\neq0&amp;lt;/math&amp;gt; has always a solution.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: It follows directly from Corollary 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solution of equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax+by = (a,b)&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The solution of the equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = (a,b)&amp;lt;/math&amp;gt; consists of two steps as&lt;br /&gt;
&lt;br /&gt;
# determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt; - by means of base variant of Euclidean algorithms and&lt;br /&gt;
# determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; - by means of the extended variant of the algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Euclidean algorithm - base variant&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of the base variant of Euclidean algorithms is the recursive application of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = (b, a \mod b)&amp;lt;/math&amp;gt; until &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(h,0) = h&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;455x + 135y = (455,135)\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;455 = 3*135 + 50\\&lt;br /&gt;
&amp;amp;135 = 2*50 + 35\\&lt;br /&gt;
&amp;amp;50 = 1*35 + 15\\&lt;br /&gt;
&amp;amp;35 = 2*15 + 5\\&lt;br /&gt;
&amp;amp;15 = 3* 5 + 0\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;\Rightarrow (455,135) = 5\\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Pseudo code of determination gcd(a,b) (as well as storing the coefficients q[i]-s) by means of the base variant of the Euclidean algorithm can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;h = a;  \mathrm{~the~higher~value~} \\&lt;br /&gt;
&amp;amp;s = b    \mathrm{~the~smaller~value~} \\&lt;br /&gt;
&amp;amp;i = 0; \\&lt;br /&gt;
&amp;amp;while (s &amp;gt; 0)    \mathrm{~until~} s \mathrm{~reaches ~} 0 \\&lt;br /&gt;
&amp;amp;\{ \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }q[i++] = h \div s; \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }t = s; \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }s = h \% s; \mathrm{~next~} s \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }h = t;    \mathrm{~next~} h \\&lt;br /&gt;
&amp;amp;\} \\&lt;br /&gt;
&amp;amp;n = i-1; \\&lt;br /&gt;
&amp;amp;gcd = h; \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Euclidean algorithm - extended variant&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The extended Euclidean algorithm is used to determine the unknowns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; after carrying out the base variant of the Euclidean algorithm. This is a necessary previous step, since the extended Euclidean algorithm uses the quotient and remainders computed in the course of executing the steps of the base variant of Euclidean algorithms. The idea of extended Euclidean algorithm is a recursive application of backward substitution based on the steps of the base variant of Euclidean algorithms. This is shown in the next example.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;455x + 135y = 5 \\&lt;br /&gt;
&amp;amp; \\&lt;br /&gt;
&amp;amp; \mathrm{~Starting~with~last~but~one~line~of~the~solution~by~the~base~variant~we~get~} \\ &lt;br /&gt;
5 &amp;amp;= 35 - 2*15 = \\&lt;br /&gt;
&amp;amp;= 35 - 2*(50 - 1*35) = -2*50 + 3*35 = \\&lt;br /&gt;
&amp;amp;= -2*50 + 3*(135 - 2*50) = 3*135 - 8*50 = \\&lt;br /&gt;
&amp;amp;= 3*135 - 8*(455 - 3*135) = -8*455 + 27*135&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;\Rightarrow  x=-8, y=27 &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; The time complexity&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The time complexity of both the base and extended variant of Euclidean algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O((\log h)^2)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h&amp;lt;/math&amp;gt; is the number of digits in the smaller number among &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;fermateuler-theorem-and-little-fermat-theorem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Fermat–Euler theorem and little Fermat theorem) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Euler’s phi function&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Euler’s phi function, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;, also called as Euler’s totient function, is defined as the number of integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; in the range &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \leq k \leq n&amp;lt;/math&amp;gt;, for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively primes. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\phi(n) = |{1&amp;lt;=k&amp;lt;=n  \mathrm{~such~that~} (k,n)=1}|,&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A|&amp;lt;/math&amp;gt; stands for the cardinality of the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;. Note that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; never includes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, since&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n,n) = n \neq 1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\Rightarrow  \phi(n) &amp;lt;= n-1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - Computation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(10)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\{{1&amp;lt;=k&amp;lt;=10  \mathrm{~such~that~} (k,10)=1}\} = \{1,3,7,9\} \\&lt;br /&gt;
    &amp;amp;\Rightarrow  \phi(10) = |{1,3,7,9}| = 4.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The properties of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
# If p is prime then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(p) = p-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If (m,n)=1 then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m*n)=\phi(m)*\phi(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If p and q are prime then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(p*q) = (p-1)*(q-1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof. This property follows from properties 2. and 1.&lt;br /&gt;
# In general &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; can be expressed by the prime factorisation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n) = n*\prod_{i=1}^{k} (1-1/p_i)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=\prod_{i=1}^{k}p_i^{e_i}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The order of congruence classes relative prime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; is exactly &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;. If m prime then this order is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fermat–Euler theorem&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Fermat–Euler theorem - also called as Euler’s theorem&amp;lt;/u&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively prime then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{\phi(n)} \equiv 1 \mod n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fermat’s little theorem&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Fermat’s little theorem&amp;lt;/u&amp;gt; - If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is prime and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively prime then &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{p-1} \equiv 1 \mod n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fermat’s little theorem is a special case Fermat–Euler theorem for the case where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is prime.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modular-multiplicative-inverse-and-its-computation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modular multiplicative inverse and its computation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Residue systems modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Complete system of residues modulo m&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is any set of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; integers so that each element comes from a different congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is the set &amp;lt;span&amp;gt;0,1,..., m-1&amp;lt;/span&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Reduced residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Reduced residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is a set obtained from complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; by deleting all elements being not coprime with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modular multiplicative inverse of an integer&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;, is the integer x that is given by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax \equiv 1 \mod m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe, that not every elements of a complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse !&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Theorem&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
An integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; element of complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; are relatively prime, in other words if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m) = 1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;ax \equiv 1 \mod m \Leftrightarrow ax + bm = 1\\&lt;br /&gt;
    &amp;amp;\mathrm{~The~equation~} ax + my = 1 \mathrm{~has~solution~if~and~only~if~} (a,m) = 1.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The modular multiplicative inverse of integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{-1}&amp;lt;/math&amp;gt;. This can be explained by dividing the relation the relation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax \equiv 1 \mod m&amp;lt;/math&amp;gt; formally by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;. With this notation holds the relation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{-1} \equiv x \mod m  \Leftrightarrow ax \equiv 1 \mod m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If exists, the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is determined uniquely&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is prime then each of the elements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{1,..., m-1}&amp;lt;/math&amp;gt; of the least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: Each element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{1,..., m-1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; are relatively primes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Computation of the modular multiplicative inverse&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m, (a,m)=1&amp;lt;/math&amp;gt; can be computed on the following ways.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Computation way 1. - by using the extended Euclidean algorithm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax \equiv 1 \mod m \Leftrightarrow ax + bm = 1.&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m)=1&amp;lt;/math&amp;gt; the equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax + bm = 1&amp;lt;/math&amp;gt; has solution. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Solving the equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax + bm = 1&amp;lt;/math&amp;gt; by the extended Euclidean algorithm, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; gives the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m&amp;lt;/math&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Computation way 2. - by means of efficient computation of raising an integer to a higher power, using a formula based on Euler’s theorem &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{\phi(n)-1}*a \equiv 1 \mod n \Rightarrow a^{-1} \equiv a^{\phi(n)-1} \mod n&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m&amp;lt;/math&amp;gt; are given by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{\phi(n)-1} \mod n&amp;lt;/math&amp;gt;, which can be determined by efficient computation of a modular multiplicative inverse - by using exponentiation by squaring.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modular exponentiation by squaring&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modular exponentiation is raising an integer to a higher power modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, in other words computing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e \mod n&amp;lt;/math&amp;gt;. Exponentiation by squaring is an efficient computation of modular exponentiation. The idea of exponentiation by squaring is to compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e \mod n&amp;lt;/math&amp;gt; by the help of successive squares of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt;. This can be implemented as follows.&lt;br /&gt;
&lt;br /&gt;
* Rearrange &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e&amp;lt;/math&amp;gt; by using the binary representation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g^e = g^{(\sum_{i=0}^{k}e_i*2^i)} = \prod_{i=0}^{k} g^{e_i*2^i}.&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Only those terms of the product must be computed, for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=1&amp;lt;/math&amp;gt;, since for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=0&amp;lt;/math&amp;gt; the term &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{e_i*2^i}&amp;lt;/math&amp;gt; becomes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{0*2^i}=1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The terms with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=1&amp;lt;/math&amp;gt; becomes powers of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{2^i}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Computation of the powers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{2^i}&amp;lt;/math&amp;gt; successively by applying &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g^{2^{l+1}} = (g^{2^l})^2  \mathrm{~for~} l&amp;gt;=0&amp;lt;/math&amp;gt;&lt;br /&gt;
* Computate each term with mod &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - Exponentiation by squaring&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;3^{52} \mod 100 \\&lt;br /&gt;
&amp;amp; \\&lt;br /&gt;
&amp;amp;52 = 110100 = 2^2+2^4+2^5 \\&lt;br /&gt;
&amp;amp;3^{(2^0)} = 3\\&lt;br /&gt;
&amp;amp;3^{(2^1)} = 3^2 = 9\\&lt;br /&gt;
&amp;amp;3^{(2^2)} = 9^2 = 81\\&lt;br /&gt;
&amp;amp;3^{(2^3)} = 81^2 \mod 100 = 61\\&lt;br /&gt;
&amp;amp;3^{(2^4)} = 61^2 \mod 100 = 21\\&lt;br /&gt;
&amp;amp;3^{(2^5)} = 21^2 \mod 100 = 41\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;3^{52} \mod 100 = 81*21*41 \mod 100 = 41.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Conclude that instead of 52 multiplications only 5 squaring and 3 multiplications were needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;discrete-logarithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discrete logarithm ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Primitive root modulo m&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; if for every integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; being coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; (i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m)=1&amp;lt;/math&amp;gt;) there is an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^k \equiv a \mod n&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Interpretation&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
All elements of the set of congruence classes coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; can be generated by power of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. Therefore&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is also called as generator of the set of congruence classes coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; and&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; must be coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is the lowest power of a which is congruent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Statement&amp;lt;/u&amp;gt; The multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is because&lt;br /&gt;
&lt;br /&gt;
* this power of a is congruent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{\phi(m)} \equiv 1 \mod n&amp;lt;/math&amp;gt; due to Euler’s theorem and&lt;br /&gt;
* this is the lowest power as the other lower powers are needed to generate the other elements of the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It follows that if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is prime then the multiplicative order &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m) = m-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that not all elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; are primitive root modulo m ! However the non-primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; elements are cyclic generator of a subset of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;. The non-primitive root elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; have also multiplicative order, which is can be however less then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m=7&amp;lt;/math&amp;gt; prime &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;(\mathbb{Z}/7\mathbb{Z})^* - \mathrm{~least~residue~system~modulo~} 7 = {0,1,..., 6}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
&amp;amp;\mathrm{~~The~elements~} 3 \mathrm{~and~} 4 \mathrm{~are~primitive~root~modulo~} m. \\&lt;br /&gt;
&amp;amp;\mathrm{~~For~example~the~element~} 2 \mathrm{~is~not~primitive~root~modulo~} m!\\&lt;br /&gt;
&amp;amp;\mathrm{~~}\Rightarrow \mathrm{~~Multiplicative~order~of~} 2 \mathrm{~is~} 3 &amp;lt; \phi(7)=6, \mathrm{~since~} 2^3 \equiv 1 \mod 7. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Discrete logarithm to the base &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Discrete logarithm (also called index)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Discrete logarithm, also called index When &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a=g^k \equiv a \mod m&amp;lt;/math&amp;gt; then the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; is called as discrete logarithm of the integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; to the base &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is an element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;, i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The practical importance of the discrete logarithm lies in its property that computation of discrete logarithm is believed to be difficult to perform, especially for some specific groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;application-to-cryptography&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Application to cryptography ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; RSA cryptography&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RSA is a cryptosystem, called after its developers: Rivest, Shamir and Adleman. The principle of the key generation can be described by means of the following steps.&lt;br /&gt;
&lt;br /&gt;
* Step 1. Select large primes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt;, e.g. each of them with size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;512&amp;lt;/math&amp;gt; bits.&lt;br /&gt;
* Step 2. Compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=p*q&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 3. Compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)= (p-1)*(q-1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 4. Select a random integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; e &amp;lt; \phi(n)&amp;lt;/math&amp;gt;, such that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; is coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 5. Determine an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; d &amp;lt; \phi(n)&amp;lt;/math&amp;gt;, such that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e*d \mod \phi(n) = 1&amp;lt;/math&amp;gt;, i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; is modular multiplicative inverse of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; can be computed&lt;br /&gt;
** either by using the extended Euclidean algorithm&lt;br /&gt;
** or by the help of Euler’s theorem and using exponentiation by squaring.&lt;br /&gt;
&lt;br /&gt;
The keys are called as&lt;br /&gt;
&lt;br /&gt;
* private key = d&lt;br /&gt;
* public keys = e, n&lt;br /&gt;
&lt;br /&gt;
Secret parameters of the key generation: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p, q, \phi(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The usage of RSA for encryption can be explained as&lt;br /&gt;
&lt;br /&gt;
* Notation: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; = message, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; = chipertext - both in form natural numbers&lt;br /&gt;
* Condition: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m &amp;lt; n&amp;lt;/math&amp;gt; - needed for the correct decryption, see below.&lt;br /&gt;
* The encryption end decryption processes&lt;br /&gt;
** The encryption &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c = m^e \mod n,&amp;lt;/math&amp;gt;&lt;br /&gt;
** The decryption &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;m&amp;#039; = c^d \mod n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correctness of the RSA cryptographic algorithm can be shows by showing &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;m&amp;#039;=m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proof: Using the way of generation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; we have &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;e*d \mod \phi(n) = 1 \Rightarrow e*d = 1 + k*\phi(n)&amp;lt;/math&amp;gt; By using it, the decrypted chipertext &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;#039;&amp;lt;/math&amp;gt; can be rearranged as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
m&amp;#039; &amp;amp;= c^d\mod n = (m^e)^d\mod n = m^{e*d}\mod n  = m^{1 + k*\phi(n)}\mod n =\\&lt;br /&gt;
&amp;amp;= [(m^1\mod n) * ((m^{\phi(n)})^k\mod n)]\mod n = \\&lt;br /&gt;
&amp;amp; \mathrm{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow  \mathrm{~condition~} m &amp;lt; n \\&lt;br /&gt;
&amp;amp;= [m * ((m^{\phi(n)} \mod n)^k) \mod n] \mod n = \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow \mathrm{~Euler&amp;#039;s~theorem~}\\&lt;br /&gt;
&amp;amp;= (m * 1) \mod n = m \\&lt;br /&gt;
&amp;amp;\mathrm{\  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow \mathrm{~condition~} m &amp;lt; n. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, that proof of correctness is also possible by using Fermat’s little theorem utilizing the fact that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n = p*q&amp;lt;/math&amp;gt;, i.e. multiplication of two primes.&lt;br /&gt;
&lt;br /&gt;
RSA can be used both for&lt;br /&gt;
&lt;br /&gt;
* encryption and&lt;br /&gt;
* authentication,&lt;br /&gt;
&lt;br /&gt;
in both cases including key distribution. Proof of correctness for using RSA for authentication can be shown similar to that one provided for the case of using it for encryption.&lt;br /&gt;
&lt;br /&gt;
The secrecy of RSA is based on the computational difficulty of prime factorization.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; If n could be factorized on efficient way then the secrecy of RSA would be broken !!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Diffie–Hellman key exchange&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Diffie–Hellman key exchange is a protocol for secure key distribution. The principle of the solution is to generate the common secret key without exchanging the key itself. This is achieved on the way that each party shares only a partial info on the key to be generated.&lt;br /&gt;
&lt;br /&gt;
The Diffie-Hellman key establishment protocol can be described by the following steps.&lt;br /&gt;
&lt;br /&gt;
* Step 1. The parties A and B agree on a prime &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and a natural number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; g &amp;lt; p&amp;lt;/math&amp;gt;, which is a primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Step 2. Each party selects a secret number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha &amp;lt; p-1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta &amp;lt; p-1&amp;lt;/math&amp;gt;, and computes the power &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = g^{\alpha} \mod p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b = g^{\beta} \mod p&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Step 3. Each party sends &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; to the other party.&lt;br /&gt;
* Each party computes the common secret key &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; based on the received numbers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =a^{\beta} \mod p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k = b^{\alpha} \mod p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Keys arising in the key exchange protocol are classified as&lt;br /&gt;
&lt;br /&gt;
* Public keys: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p, g, a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;&lt;br /&gt;
* Private keys: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operation way of the Diffie-Hellman key exchange protocol is shown in Figure [[#fig:Diffie-Hellman_ke|1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Diffie-Hellman_ke&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:Diffie-Hellman_key_exchange.jpg|460px|thumb|center|Figure 1: Diffie-Hellman key exchange protocol &lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The equality of the keys generated on the different sides can be shown as follows. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
a^{\beta} \mod p &amp;amp;= (g^{\alpha})^{\beta} \mod p = g^{\alpha * \beta} \mod p = \\&lt;br /&gt;
    &amp;amp;= (g^{\beta})^{\alpha} \mod p = b^{\alpha} \mod p \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The secrecy of Diffie-Hellman key exchange protocol is based on the computational difficulty of the discrete logarithms, more precisely on determining &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = g^{\alpha} \mod p&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b = g^{\beta} \mod p&amp;lt;/math&amp;gt; in the knowledge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;combinatorics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Combinatorics ==&lt;br /&gt;
&lt;br /&gt;
For an introduction to basics of combinatorics see [https://en.wikipedia.org/wiki/Permutation Permutation] and [https://en.wikipedia.org/wiki/Combination Combination].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;relations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Relations ==&lt;br /&gt;
&lt;br /&gt;
For an introduction and overview on mathematical relations see [https://en.wikipedia.org/wiki/Relation_(mathematics) Relation].&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Sarrus_rule1.png&amp;diff=6544</id>
		<title>Datei:Sarrus rule1.png</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Sarrus_rule1.png&amp;diff=6544"/>
		<updated>2025-03-13T20:26:20Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:ROC_curve.jpg&amp;diff=6543</id>
		<title>Datei:ROC curve.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:ROC_curve.jpg&amp;diff=6543"/>
		<updated>2025-03-13T20:25:56Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Language_first_order_logic_BNF_gramma.jpg&amp;diff=6542</id>
		<title>Datei:Language first order logic BNF gramma.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Language_first_order_logic_BNF_gramma.jpg&amp;diff=6542"/>
		<updated>2025-03-13T20:25:31Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_weighted_graph.jpg&amp;diff=6541</id>
		<title>Datei:Exa weighted graph.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_weighted_graph.jpg&amp;diff=6541"/>
		<updated>2025-03-13T20:23:16Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_undirected_graph.jpg&amp;diff=6540</id>
		<title>Datei:Exa undirected graph.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_undirected_graph.jpg&amp;diff=6540"/>
		<updated>2025-03-13T20:22:49Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_neg_weight.jpg&amp;diff=6539</id>
		<title>Datei:Exa graph neg weight.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_neg_weight.jpg&amp;diff=6539"/>
		<updated>2025-03-13T20:22:25Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_minvc.jpg&amp;diff=6538</id>
		<title>Datei:Exa graph minvc.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_minvc.jpg&amp;diff=6538"/>
		<updated>2025-03-13T20:22:01Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_H_cycle.jpg&amp;diff=6537</id>
		<title>Datei:Exa graph H cycle.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_H_cycle.jpg&amp;diff=6537"/>
		<updated>2025-03-13T20:21:40Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_E-path.jpg&amp;diff=6536</id>
		<title>Datei:Exa graph E-path.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_E-path.jpg&amp;diff=6536"/>
		<updated>2025-03-13T20:21:13Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_E-cycle.jpg&amp;diff=6535</id>
		<title>Datei:Exa graph E-cycle.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_E-cycle.jpg&amp;diff=6535"/>
		<updated>2025-03-13T20:20:51Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_cpp_weighted.jpg&amp;diff=6534</id>
		<title>Datei:Exa graph cpp weighted.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_cpp_weighted.jpg&amp;diff=6534"/>
		<updated>2025-03-13T20:20:31Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_cpp_unweighted.jpg&amp;diff=6533</id>
		<title>Datei:Exa graph cpp unweighted.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Exa_graph_cpp_unweighted.jpg&amp;diff=6533"/>
		<updated>2025-03-13T20:20:11Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Diffie-Hellman_key_exchange.jpg&amp;diff=6532</id>
		<title>Datei:Diffie-Hellman key exchange.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:Diffie-Hellman_key_exchange.jpg&amp;diff=6532"/>
		<updated>2025-03-13T20:19:31Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:3D_determinant_as_area_parallelepiped.png&amp;diff=6531</id>
		<title>Datei:3D determinant as area parallelepiped.png</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:3D_determinant_as_area_parallelepiped.png&amp;diff=6531"/>
		<updated>2025-03-13T20:18:49Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:2D_determinant_as_area_parallelogram.png&amp;diff=6530</id>
		<title>Datei:2D determinant as area parallelogram.png</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:2D_determinant_as_area_parallelogram.png&amp;diff=6530"/>
		<updated>2025-03-13T20:18:07Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=References&amp;diff=6529</id>
		<title>References</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=References&amp;diff=6529"/>
		<updated>2025-03-11T22:52:54Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;div class=&amp;quot;thebibliography&amp;quot;&amp;gt;  G. H. Hardy and Edward M. Wright. &amp;#039;&amp;#039;Theory of Numbers&amp;#039;&amp;#039;. Oxford University Press, Forth Edition, 1975.  Serge Lang. &amp;#039;&amp;#039;Linear ALgebra&amp;#039;&amp;#039;. Springer, Third Edition, 1987.  Jonathan L. Gross and Jay Yellen. &amp;#039;&amp;#039;Graph Theory and Its Applications&amp;#039;&amp;#039;. Second Edition, Taylor &amp;amp;amp; Francis, 1998.  Martine Labbé, Gilbert Laporte, Martín Inmaculada Rodríguez, González, Juan José Salazar. . &amp;#039;&amp;#039;Networks.&amp;#039;&amp;#039;, 43 (3): 177–189, 2004. doi…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;thebibliography&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
G. H. Hardy and Edward M. Wright. &amp;#039;&amp;#039;Theory of Numbers&amp;#039;&amp;#039;. Oxford University Press, Forth Edition, 1975.&lt;br /&gt;
&lt;br /&gt;
Serge Lang. &amp;#039;&amp;#039;Linear ALgebra&amp;#039;&amp;#039;. Springer, Third Edition, 1987.&lt;br /&gt;
&lt;br /&gt;
Jonathan L. Gross and Jay Yellen. &amp;#039;&amp;#039;Graph Theory and Its Applications&amp;#039;&amp;#039;. Second Edition, Taylor &amp;amp;amp; Francis, 1998.&lt;br /&gt;
&lt;br /&gt;
Martine Labbé, Gilbert Laporte, Martín Inmaculada Rodríguez, González, Juan José Salazar. . &amp;#039;&amp;#039;Networks.&amp;#039;&amp;#039;, 43 (3): 177–189, 2004. doi:10.1002/net.10114. ISSN 0028-3045&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Numerische_Methoden_und_Performance_Computing&amp;diff=6528</id>
		<title>Numerische Methoden und Performance Computing</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Numerische_Methoden_und_Performance_Computing&amp;diff=6528"/>
		<updated>2025-03-11T22:52:24Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Number Theory]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Graph Theory and Algorithms]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Linear Algebra and Algorithms]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Logic]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Metrics in Data Science]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[References]] &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logik&amp;diff=6527</id>
		<title>Logik</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logik&amp;diff=6527"/>
		<updated>2025-03-11T22:50:29Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Logic =  &amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Mathematical logic ==  Mathematical logic is the study of logic in mathematics.  &amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; === Propositional logic ===  Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Language_first_order_logic_BNF_grammar.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Linear_Algebra_and_Algorithms&amp;diff=6526</id>
		<title>Linear Algebra and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Linear_Algebra_and_Algorithms&amp;diff=6526"/>
		<updated>2025-03-11T22:48:57Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;linear-algebra-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Linear Algebra and Algorithms =  For a comprehensive subject on linear algebra the reader is referred to the book [Lang(1987)].  &amp;lt;span id=&amp;quot;linear-algebra&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Linear Algebra ==  &amp;lt;span id=&amp;quot;basic-terms-and-definitions&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; === Basic terms and definitions ===  A vector is a one-dimensional array of scalars, i.e. real or complex numbers. We will denote a vector by lowercase bold letters, like e.g.…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;linear-algebra-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Linear Algebra and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on linear algebra the reader is referred to the book [Lang(1987)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-algebra&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Linear Algebra ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basic-terms-and-definitions&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basic terms and definitions ===&lt;br /&gt;
&lt;br /&gt;
A vector is a one-dimensional array of scalars, i.e. real or complex numbers. We will denote a vector by lowercase bold letters, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}&amp;lt;/math&amp;gt;. In linear algebra two forms of vectors are distinguished: row vector and column vector. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(&lt;br /&gt;
\begin{array}{llllll}&lt;br /&gt;
2 &amp;amp; 1 &amp;amp; 4 &amp;amp; 5 &amp;amp; 3&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a row vector and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
2 \\&lt;br /&gt;
1 \\&lt;br /&gt;
5 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a column vector.&lt;br /&gt;
&lt;br /&gt;
An &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix is a two-dimensional array of scalars having &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; rows an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; columns. The scalar elements of matrix can be real or complex numbers. We consider only real matrices, i.e. matrices with real elements. Matrices will be denoted by uppercase bold letters. For example matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf F} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 4&amp;lt;/math&amp;gt; matrix. Matrices can be seen as generalization of vectors, and thus vectors as special cases of matrices, where either the number of columns or rows is one. So the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-element row vector is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \times n&amp;lt;/math&amp;gt; matrix and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-element column vector is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; matrix.&lt;br /&gt;
&lt;br /&gt;
A square matrix has the same number of rows and columns, i.e. is of type &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt;, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is called as the order of the square matrix. An example of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; is given below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf S} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
1 &amp;amp; 1 &amp;amp; 3 \\&lt;br /&gt;
7 &amp;amp; 2 &amp;amp; 10 \\&lt;br /&gt;
4 &amp;amp; 5 &amp;amp; 3  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A diagonal matrix is a special square matrix, in which only the diagonal elements can differ from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. An example for the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf D} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
3 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 4 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 4&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The diagonal matrix can be given also by means of a diag() operation by listing only the diagonal elements of the matrix as its arguments. For example the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; can be given on such a way as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf D} = diag(3,4,0,4).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The element in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of a matrix is referred as the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element of that matrix and is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}_{i,j}&amp;lt;/math&amp;gt;. It is usual to construct a matrix by the help of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt; . If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; denotes a defining formula of double indexed scalars for some range of indices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; then matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which means matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is composed as grouping the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; by two dimensions, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; describes the row index and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; the column index. Therefore the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is set to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; for every values of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; in their given ranges. For example if the double indexed scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;z_{ij}&amp;lt;/math&amp;gt; are defined as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;z_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~} i == j ~~  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\} ~ i,j = 1,2,3.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then defining matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = [\ z_{ij} ]\ &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
leads to &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
1 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 1 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; identity matrix. The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; identity matrix for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \in \mathbb{N}^+&amp;lt;/math&amp;gt; is characterized by having the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; in its every diagonal positions and all its other elements are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. Therefore the identity matrix is a special diagonal matrix. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; stands for the column vector having the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; on its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th position, while its every other elements are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. In an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean space the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt; represents the unit vector in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th dimension. For example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; the unit vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf i}&amp;lt;/math&amp;gt; are given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 1} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
1 \\&lt;br /&gt;
0 \\&lt;br /&gt;
0&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 2} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
0 \\&lt;br /&gt;
1 \\&lt;br /&gt;
0&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;{\bf e}_{\bf 3} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
0 \\&lt;br /&gt;
0 \\&lt;br /&gt;
1&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; identity matrix can be also expressed as row vector of the unit vectors as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf I} = \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
{\bf e}_{\bf 1} &amp;amp; {\bf e}_{\bf 2} &amp;amp; {\bf e}_{\bf 3} &lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elementary-matrix-operations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Elementary matrix operations ===&lt;br /&gt;
&lt;br /&gt;
An elementary univariate operation on matrices is the transpose operation. The transpose of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is defined by exchanging its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element by its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(j,i)&amp;lt;/math&amp;gt;-th element for each pair of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; in their given ranges. The transpose of a matrix is called transposed matrix and transpose of a given matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^T&amp;lt;/math&amp;gt;. For example the transpose of the above defined matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf F}^T =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 1 &amp;amp; 4 \\ &lt;br /&gt;
3 &amp;amp; 4 &amp;amp; 8 \\&lt;br /&gt;
6 &amp;amp; 10 &amp;amp; 2 \\&lt;br /&gt;
1 &amp;amp; 5 &amp;amp; 4&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The transpose of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; matrix and thus the transpose operation changes the dimensionality of the matrix for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \neq m&amp;lt;/math&amp;gt;. The transpose of square matrix remains a square matrix. The transpose of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \times n&amp;lt;/math&amp;gt; row matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column matrix and vice versa.&lt;br /&gt;
&lt;br /&gt;
The multiplication of matrix by a scalar is defined elementwise, i.e.by multiplying each element of the matrix by the given scalar. For example matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}&amp;lt;/math&amp;gt; multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c=3&amp;lt;/math&amp;gt; gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c {\bf F} =3 \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)= \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
6 &amp;amp; 9 &amp;amp; 18 &amp;amp; 3\\&lt;br /&gt;
3 &amp;amp; 12 &amp;amp; 30 &amp;amp; 15\\&lt;br /&gt;
12 &amp;amp; 24 &amp;amp; 6 &amp;amp; 12 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two matrix can be added if they are of same type, i.e. both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt;. Similarly a matrix can be substracted form another one if they are of same type. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 4&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf G}&amp;lt;/math&amp;gt; is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf G} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
7 &amp;amp; -2 &amp;amp; 5 &amp;amp; -4\\&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; -1 &amp;amp; 3\\&lt;br /&gt;
-4 &amp;amp; 1 &amp;amp; 4 &amp;amp; 2 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T}&amp;lt;/math&amp;gt; as the sum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf G} +  {\bf F}&amp;lt;/math&amp;gt; are given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf T}={\bf G} + {\bf F} &amp;amp;=\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
7 &amp;amp; -2 &amp;amp; 5 &amp;amp; -4\\&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; -1 &amp;amp; 3\\&lt;br /&gt;
-4 &amp;amp; 1 &amp;amp; 4 &amp;amp; 2 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) + &lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\&lt;br /&gt;
&amp;amp;=&lt;br /&gt;
\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
9 &amp;amp; 1 &amp;amp; 11 &amp;amp; -3\\&lt;br /&gt;
3 &amp;amp; 7 &amp;amp; 9 &amp;amp; 8\\&lt;br /&gt;
0 &amp;amp; 9 &amp;amp; 6 &amp;amp; 6 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two matrix can be multiplied if the number of columns of the first matrix and the number of rows of the second one are the same. The multiplication of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times k&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, gives an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times k&amp;lt;/math&amp;gt; times product matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt;. Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j,k&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,k&amp;lt;/math&amp;gt;-th elements of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; be &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_{jk}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_{ik}&amp;lt;/math&amp;gt;, respectively. Then the matrix multiplication&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf P} = {\bf A} {\bf B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is defined by the elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;p_{ik} = \sum_{j=1}^{m} a_{ij} b_{jk} ~~\mathrm{~for~} i=1,\ldots,n, ~~k=1,\ldots, k.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hence the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,k)&amp;lt;/math&amp;gt;-th element of the product matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf P}&amp;lt;/math&amp;gt; is the (scalar) product of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-th column of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; both consisting of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; elements. In order to illustrate the matrix multiplication we define the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4 \times 3&amp;lt;/math&amp;gt; times matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf H} =\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
-1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then the matrix product &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F} {\bf H}&amp;lt;/math&amp;gt; results in a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; times matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt;, which is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf R} = {\bf F} {\bf H} &amp;amp;=\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
2 &amp;amp; 3 &amp;amp; 6 &amp;amp; 1\\&lt;br /&gt;
1 &amp;amp; 4 &amp;amp; 10 &amp;amp; 5\\&lt;br /&gt;
4 &amp;amp; 8 &amp;amp; 2 &amp;amp; 4 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)\left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
-1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \\ &amp;amp;= \left(\begin{array}{lll}&lt;br /&gt;
22 &amp;amp; 8 &amp;amp; 14 \\ &lt;br /&gt;
52 &amp;amp; 27 &amp;amp; 21 \\&lt;br /&gt;
22 &amp;amp; 14 &amp;amp; 36&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}&amp;lt;/math&amp;gt; stands for the column vector having every element set to value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. It is called unit vector. Multiplying a matrix from right by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}&amp;lt;/math&amp;gt; gives the row sums of that matrix in a column vector form. For example&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf H}{\bf e} = \left(&lt;br /&gt;
\begin{array}{llll}&lt;br /&gt;
    1 &amp;amp; -2 &amp;amp; 3 \\ &lt;br /&gt;
    -1 &amp;amp; 1 &amp;amp; 2 \\&lt;br /&gt;
    3 &amp;amp; 1 &amp;amp; 0 \\&lt;br /&gt;
    5 &amp;amp; 3 &amp;amp; 2&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
    1  \\ &lt;br /&gt;
    1  \\&lt;br /&gt;
    1 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
    2 \\ &lt;br /&gt;
    2  \\&lt;br /&gt;
    4  \\&lt;br /&gt;
    10&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gives the row sum of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The addition of matrices is commutative and associative, i.e. the following relations hold for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{O1.~}{\bf A}+{\bf B} = {\bf B}+ {\bf A}, ~~~~~~~~~~~~~~~~~~\mathrm{~commutativity~of~}+\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{O2.~}{\bf A}+\left({\bf B} + {\bf C}\right) = \left({\bf A}+{\bf B}\right) + {\bf C}~~\mathrm{~associativity~of~}+&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The matrix multiplication is distributive with respect to the matrix addition and matrix multiplication is associative, i.e. the following relations hold for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times k&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k \times l&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{O3.~}{\bf A} \left({\bf B}+{\bf D} \right) = {\bf A} {\bf B} + {\bf A}{\bf D} , ~~\mathrm{~distributivity~of~}*\mathrm{~with~respect~to~}+\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{O4.~}{\bf A}\left({\bf B}{\bf C}\right) = \left({\bf A}{\bf B}\right){\bf C}~~~~~~~~~~~\mathrm{~associativity~of~}*&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However matrix multiplication is in general, except from some special cases, NOT commutative, i.e. for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{O5.~}{\bf A}{\bf B} \neq {\bf B}{\bf A}\mathrm{~in~general~}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} .&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore multiplication/product of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; is not specified. Instead one should speak about multiplying matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; from right (by default) or from left.&lt;br /&gt;
&lt;br /&gt;
The special classes of matrices, for which commutativity holds includes&lt;br /&gt;
&lt;br /&gt;
* multiplication by identity matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf I}={\bf I}{\bf A}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* multiplication of diagonal matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 2}&amp;lt;/math&amp;gt; with each other: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}_{\bf 1}{\bf D}_{\bf 2}={\bf D}_{\bf 2}{\bf D}_{\bf 1}&amp;lt;/math&amp;gt;,&lt;br /&gt;
* multiplication of two powers of the same matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^n{\bf A}^m = {\bf A}^m{\bf A}^n&amp;lt;/math&amp;gt; and&lt;br /&gt;
* multiplication of two polynomials of the same matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_1({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_2({\bf A})&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P_1({\bf A}) P_2({\bf A})=P_2({\bf A}) P_1({\bf A})&amp;lt;/math&amp;gt;, which follows from the commutativity of two powers of the same matrix by repetitive application of distributivity of the matrix multiplication.&lt;br /&gt;
&lt;br /&gt;
Further useful relations are&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\left({\bf A}+{\bf B}\right)^T={\bf A}^T + {\bf B}^T \\&lt;br /&gt;
&amp;amp; \left({\bf A}{\bf B}\right)^T={\bf B}^T  {\bf A}^T.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The major difference of the elementary matrix operations comparing to their scalar counterparts is that matrix multiplication is not commutative in general. This has far-reaching consequences for the matrix theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-independence-of-vectors&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Linear independence of vectors ===&lt;br /&gt;
&lt;br /&gt;
The expression&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c_1{\bf v}_{\bf 1} + \ldots c_n{\bf v}_{\bf n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is called as a linear combination of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 1}, \ldots, {\bf v}_{\bf n}&amp;lt;/math&amp;gt; and the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_1,\ldots, c_n&amp;lt;/math&amp;gt; are weights. Linear, since the used operations &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+&amp;lt;/math&amp;gt; and constant multiplication are linear.&lt;br /&gt;
&lt;br /&gt;
For example each vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; pointing to a point in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space can be given as a linear combinations of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w} = x{\bf e}_{\bf 1} + y{\bf e}_{\bf 2} + z{\bf e}_{\bf 3}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We say that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; span the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space and hence generate the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional space. There are infinite many other vector combinations, which span the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space, the vector are not necessarily be perpendicular to each other, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 1}=(1,2,3)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 2}=(-1,1,2)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 3} = (0,0,1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However if we consider the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}=(1,0,0)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}=(0,1,0)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0} = (2,3,0)&amp;lt;/math&amp;gt; then we can only cover the vectors at the plane with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;z=0&amp;lt;/math&amp;gt; by the linear combinations of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt;. In this case we say that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; generate (or span) only a (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt;-dimensional) sub-space of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional Euclidean space. This is because the 3rd vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; can be given as the linear combination of the other two as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf v}_{\bf 0} = 2{\bf e}_{\bf 1} + 3{\bf e}_{\bf 2}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This phenomena is characterised by saying that the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; are not linear independent of each other. In fact not only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; can be given as linear combination of the other two, but any of the three vectors can be given as a linear combination of the other two. The vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; are linear dependent.&lt;br /&gt;
&lt;br /&gt;
However the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; behave on another way, none of them can be given as linear combination of the other two. We say the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 3}&amp;lt;/math&amp;gt; are linear independent. Among the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}_{\bf 2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}_{\bf 0}&amp;lt;/math&amp;gt; only any two of them are linear independent of each other.&lt;br /&gt;
&lt;br /&gt;
It can be seen that a given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; number of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vectors determine the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space if and only if they are linear independent. If they are linear dependent and only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt; of them are linear independent, then they generate (or span) only a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-dimensional sub-space of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space.&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; vectors are collected in a matrix, for example each vector put in a different row of the matrix, then the maximum number number of linear independent row vectors of the matrix is called as the rank of that matrix. The vectors can be put also in the different columns of a matrix, in which case the the maximum number of linear independent column vectors of the matrix is the rank of that matrix. It can be seen that the maximum number of linear independent rows and the maximum number of linear independent columns of a matrix are the same, so each matrix has a unique rank. The rank of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt;. Based on the above the rank of a matrix is the dimension of the subspace generated by its columns or rows as vectors.&lt;br /&gt;
&lt;br /&gt;
It follows that the the statements below hold for the rank of a matrix.&lt;br /&gt;
&lt;br /&gt;
* The rank of an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times m&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is at most the smaller of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;rank({\bf A}) \leq \min(n,m).&amp;lt;/math&amp;gt;&lt;br /&gt;
* The rank of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is at most its order, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;rank({\bf A}) \leq n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;determinant&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Determinant ===&lt;br /&gt;
&lt;br /&gt;
The determinant is a scalar assigned to a square matrix. It depends on every elements of the matrix, hence determinant is a scalar function of the square matrix. The determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; (or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det{\bf A}&amp;lt;/math&amp;gt;) and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|{\bf A}|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Expression of determinant - Leibniz formula&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The determinant is a sum of signed products, where each product is composed as a multiplication of elements taken from each row of the square matrix, each of them at different column positions and every such products are included in the sum. In other words the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}= [\ a_{i j} ]\ &amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A})= \sum_{p} sgn(p) a_{1 p(1)} \ldots a_{n p(n)} = \sum_{p} sgn(p) \left(\prod_{i=1}^n a_{i p(i)}\right),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p=p(1) \ldots p(n)&amp;lt;/math&amp;gt; is a permutation of the column indices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \ldots n&amp;lt;/math&amp;gt; and the sign function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sgn(p)&amp;lt;/math&amp;gt; assigns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+1&amp;lt;/math&amp;gt; to a permutation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; if it can be created by even number of exchanges of two numbers starting from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \ldots n&amp;lt;/math&amp;gt; and otherwise it gives &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-1&amp;lt;/math&amp;gt;. The number of products in the sum equals to the number of possible permutations, which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n!&amp;lt;/math&amp;gt;. This expression of the determinant is called Leibniz formula.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; there are only two permutations, therefore the expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A}) = ad-bc.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix - Sarrus rule&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\ &amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; there are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3!=6&amp;lt;/math&amp;gt; permutations, three of them are encountered with sign &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;+&amp;lt;/math&amp;gt; and the other three with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-&amp;lt;/math&amp;gt;. The expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
det({\bf A}) &amp;amp;= a_{11}a_{22}a_{33} + a_{12}a_{23}a_{31} + a_{13}a_{21}a_{32} \\&lt;br /&gt;
             &amp;amp;- a_{31}a_{22}a_{13} - a_{32}a_{23}a_{11}- a_{33}a_{21}a_{12}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This expression can be easily memorized by the help of the Sarrus rule, see in Figure [[#fig:Sarrus_rule|12]]. Copying the first two columns of the matrix right to it, the products with positive sign can be obtained along the diagonals from top to down and right, while the products with negative sign are the ones from down to top and right.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Sarrus_rule&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Sarrus_rule1.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Unfortunately the schema of Sarrus can not be generalized for higher dimensions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Geometric interpretation&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The columns of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be interpreted as vectors in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean space. For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; these vectors span a parallelogram, and the determinant is exactly the signed value of the area of this parallelogram. This is shown in Figure [[#fig:2D_det_area|13]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:2D_det_area&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/2D_determinant_as_area_parallelogram.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; the column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf r}_3&amp;lt;/math&amp;gt;, form a parallelepiped and the determinant gives the signed volume of this parallelepiped, see in Figure [[#fig:3D_det_area|14]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:3D_det_area&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/3D_determinant_as_area_parallelepiped.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
This interpretation holds also for higher dimensions. So the column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; span a parallelotope in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space and the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; gives its signed &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional volume.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of determinant&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Determinant of several special matrices&lt;br /&gt;
&lt;br /&gt;
* Determinant of identity matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf I})= 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Determinant of diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = diag(d_1,\ldots,d_n)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf D}) = d_1 \ldots d_n = \prod_{i=1}^{n}d_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; has the following properties regarding row and column manipulations.&lt;br /&gt;
&lt;br /&gt;
# Multiplying matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; results in multiplication of the determinant by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c^n&amp;lt;/math&amp;gt;, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;.&amp;lt;/math&amp;gt;&lt;br /&gt;
# Multiplying any row or any column of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; leads to a multiplication of the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt;. In other words the determinant of the modified matrix is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c~det({\bf A})&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Exchanging two rows or two columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; leads to a multiplication of the determinant by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Adding a scalar multiplication of another row to a row of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; or adding a scalar multiplication of another column to a column of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; does not change the value of the determinant.&lt;br /&gt;
&lt;br /&gt;
Further useful properties of the determinant are &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{D1.~}det({\bf A}^T) = det({\bf A})\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}  \\&lt;br /&gt;
    &amp;amp;\mathrm{D2.~}det(c{\bf A})= c^n det({\bf A})~~ c \in \mathbb{R}\\&lt;br /&gt;
    &amp;amp;\mathrm{D3.~}det({\bf A}{\bf B}) = det({\bf A})det({\bf B}) \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Laplace expansion&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The minor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_{i,j}&amp;lt;/math&amp;gt; of of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} =[\ a_{i j} ]\ &amp;lt;/math&amp;gt; is defined as the determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-1) \times (n-1)&amp;lt;/math&amp;gt; submatrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, which is obtained by omitting the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1,\ldots,n&amp;lt;/math&amp;gt;. The determinant of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be expressed by expanding it along its &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row. This gives a sum of signed product of each element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row by its corresponding minor. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det({\bf A})= \sum_{j=1}^n (-1)^{(i+j)} a_{ij} M_{i,j}.&amp;lt;/math&amp;gt; This is called as Laplace expansion along the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th row of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As an example we show the Laplace expansion of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt;-dimensional square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with general notations along its 1st row, which leads to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
det({\bf A})&amp;amp;=\left| \left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| \\&lt;br /&gt;
&amp;amp;= a_{11} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| - a_{12} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{21} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right| + a_{13} \left| \left(&lt;br /&gt;
\begin{array}{lll} &lt;br /&gt;
a_{21} &amp;amp; a_{22}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \right|.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; The Laplace expansion along the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th column of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be also defined on similar way.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determinant and linear independence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One of the most important use of the determinant is its relation to linear independence. The determinant of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-zero if and only if the rows (and columns) of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear independent.&lt;br /&gt;
&lt;br /&gt;
This can be seen e.g. by the help of the geometric interpretation of the determinant. If the column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear independent then they generate the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space and thus the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-volume of the parallelotope spanned by them must be non-zero and therefore also the determinant is non-zero. However if the column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are linear dependent then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; generate only a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt;-dimensional subspace of the whole &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space, which implies that the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-volume of the parallelotope spanned by them must be zero and hence also the determinant is zero.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;inverse-matrix&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Inverse matrix ===&lt;br /&gt;
&lt;br /&gt;
We consider the question whether a matrix does exist, which multiplied by the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; results in the identity matrix. It would be an analogue of the reciprocal number in the set of real (or complex) numbers. Immediately the following questions arise&lt;br /&gt;
&lt;br /&gt;
* What is the condition of the existence of an such matrix ? Not every number has reciprocal also in the set of real numbers (i.e. the number zero).&lt;br /&gt;
* If such matrices exist for multiplying by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; both from left and right, then they are the same ?, This question is due to the general non-commutativity of the matrices.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The adjugate matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The adjugate matrix of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;, and it is defined as the transpose of the matrix of the signed minors. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; is given by its elements as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i,j} = (-1)^{(i+j)} M_{j,i} ~~ i,j = 1,\ldots,n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The importance of the adjugate matrix lies in the following relation, which holds for every square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} adj({\bf A}) = adj({\bf A}){\bf A} = det({\bf A}){\bf I}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The inverse matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is an invertable matrix if there exist a matrix, which is multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; from left gives the identity matrix and multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; from right also gives the identity matrix. This matrix is called the inverse matrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt;. Thus for the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; holds the following defining relation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} {\bf A}^{-1} = {\bf A}^{-1}{\bf A} = {\bf I}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dividing the above relation for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})&amp;lt;/math&amp;gt;, it leads to expression of the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = \frac{adj({\bf A})}{det({\bf A})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since the adjugate matrix always exists, the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; exists if and only the determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-zero. The square matrix which is not invertable is also called as singular matrix. Similarly the invertable matrix is also called as non-singular. Therefore&lt;br /&gt;
&lt;br /&gt;
* The square matrix is singular if and only if its determinant is zero.&lt;br /&gt;
* The square matrix is non-singular if and only if its determinant is non-zero.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Inverse of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The determinant of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=ad-bc&amp;lt;/math&amp;gt; Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=2&amp;lt;/math&amp;gt; all the minors are scalars. Hence the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; can be expressed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = \frac{adj({\bf A})}{det({\bf A})} = \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    d &amp;amp; -b  \\ &lt;br /&gt;
    -c &amp;amp; a \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be checked by multiplying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} {\bf A}^{-1} = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a &amp;amp; b  \\ &lt;br /&gt;
c &amp;amp; d \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    d &amp;amp; -b  \\ &lt;br /&gt;
    -c &amp;amp; a \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc} = \frac{\left(&lt;br /&gt;
    \begin{array}{ll}&lt;br /&gt;
    ad-bc &amp;amp; -ab+ab  \\ &lt;br /&gt;
    cd-cd &amp;amp; -cb+da \\&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)}{ad-bc} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; 0  \\ &lt;br /&gt;
0 &amp;amp; 1 \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; as expected. It is easy to remember the nominator of the inverse of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 \times 2&amp;lt;/math&amp;gt; matrix: the values in the main diagonal (a and d) are exchanged and the values in the secondary diagonal (b and c) are multiplied by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(-1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Inverse of a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3 \times 3&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; given as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A} = [\ a_{ij} ]\ &amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
a_{11} &amp;amp; a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=3&amp;lt;/math&amp;gt; all the minors are determinants of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt;-dimensional matrix. Hence the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^-1&amp;lt;/math&amp;gt; can be expressed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
{\bf A}^{-1} &amp;amp;= \frac{adj({\bf A})}{det({\bf A})} = \frac{\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
M_{11} &amp;amp; -M_{21} &amp;amp; M_{31}  \\ &lt;br /&gt;
-M_{12} &amp;amp; M_{22} &amp;amp; -M_{32}  \\ &lt;br /&gt;
M_{13} &amp;amp; -M_{23} &amp;amp; M_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)}{det({\bf A})} \\&lt;br /&gt;
&amp;amp;= \frac{\left(&lt;br /&gt;
\begin{array}{lll}&lt;br /&gt;
\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{22} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{32} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; \left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{12} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{22} &amp;amp; a_{23}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| \\ &lt;br /&gt;
-\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{21} &amp;amp; a_{23}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp;\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{33}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{13}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{23}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right|  \\ &lt;br /&gt;
\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{21} &amp;amp; a_{22}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; -\left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{12}  \\ &lt;br /&gt;
a_{31} &amp;amp; a_{32}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right| &amp;amp; \left|&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
a_{11} &amp;amp; a_{12}  \\ &lt;br /&gt;
a_{21} &amp;amp; a_{22}&lt;br /&gt;
\end{array}&lt;br /&gt;
\right|&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)}{det({\bf A})}&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of the inverse matrix&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inverse matrix of several special matrices&lt;br /&gt;
&lt;br /&gt;
* Inverse matrix of identity matrix is itself. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf I}^{-1}= {\bf I}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Inverse matrix of diagonal matrix is also diagonal.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = diag(d_1,\ldots,d_n)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d_i \neq 0&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}^{-1} =diag(\frac{1}{d_1},\ldots,\frac{1}{d_n})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Further useful properties of the inverse matrix are &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{I1.~}({\bf A}^{-1})^{-1} = {\bf A}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} \\&lt;br /&gt;
&amp;amp;\mathrm{I2.~}({\bf A}^T)^{-1} = ({\bf A}^{-1})^T \\&lt;br /&gt;
&amp;amp;\mathrm{I3.~}(c{\bf A})^{-1}= c^{-1} {\bf A}^{-1} ~~ c \in \mathbb{R}\\&lt;br /&gt;
&amp;amp;\mathrm{I4.~}({\bf A}{\bf B})^{-1} = {\bf B}^{-1}{\bf A}^{-1} \\&lt;br /&gt;
&amp;amp;\mathrm{I5.~}det({\bf A}^{-1}) = det({\bf A})^{-1} &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;linear-systems-of-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Linear systems of equations ===&lt;br /&gt;
&lt;br /&gt;
The linear system of equations consisting of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1,\ldots,x_n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; equations can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;a_{11}x_1 + a_{12}x_2 + \ldots + a_{1n}x_n = b_1 \\&lt;br /&gt;
&amp;amp;a_{21}x_1 + a_{22}x_2 + \ldots + a_{2n}x_n = b_2 \\&lt;br /&gt;
&amp;amp;\vdots \\&lt;br /&gt;
&amp;amp;a_{m1}x_1 + a_{m2}x_2 + \ldots + a_{mn}x_n = b_m.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; This can be also called as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations. By introducing the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times 1&amp;lt;/math&amp;gt; column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =[\ a_{ij} ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
x_1 \\&lt;br /&gt;
x_2 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
x_n \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf b} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
b_1 \\&lt;br /&gt;
b_2 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
b_m \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the system of linear equations can be rewritten in matrix vector form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}.&amp;lt;/math&amp;gt; Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is the coefficient matrix, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; is a column vector of unknowns or unknown column vector and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; is given column vector.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Reformulation - linear combination of column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above system of linear equations can be rewritten by the help of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt; on index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\  =[\ b_i ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ b_i ]\ &amp;lt;/math&amp;gt; is a vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; due to the application of the group operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\ ]\ &amp;lt;/math&amp;gt;. The order of grouping on index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and summing can be exchanged on the left hand side of the equation, which gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\sum_{j=1}^{n} [\ a_{ij}]\ x_j   =[\ b_i ]\,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Introducing the column vectors composed from the columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf a}_{\bf j} = \left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
a_{1j} \\&lt;br /&gt;
a_{2j} \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
a_{nj} \\&lt;br /&gt;
\end{array}&lt;br /&gt;
\right) ~~j = 1,\ldots, n,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the relation can be further rearranged as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\sum_{j=1}^{n} {\bf a}_{\bf j} x_j = {\bf b},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on this formulation, the problem of solving the above &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations can be seen as finding the weights &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;-s, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; with which the given vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed as the linear combination of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;- dimensional vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This interpretation enables to establish criteria for solvability for different cases of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations depending on the relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; as well as the linear independence of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solvability - general case&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following statements follow from the above linear combination interpretation for the solvability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations.&lt;br /&gt;
&lt;br /&gt;
# The linear system of equations is solvable if and only if vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed as linear combination of the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;, in other words if the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; and vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; are linear dependent. This means that adding vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; to the set of vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; does not increase the number of linear independent vectors in the set. This is equivalent to the statement that the extended matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^*&amp;lt;/math&amp;gt; obtained as adding column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n+1)&amp;lt;/math&amp;gt; column to matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, has the same rank as matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt; then two cases must be distinguished according to the relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
#* If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt; then the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; generate the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional space, in which the weights of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; is unique, therefore the system has a unique solution. Note that in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \geq n&amp;lt;/math&amp;gt; must be, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})&amp;lt;/math&amp;gt; can not be greater than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\min(m,n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
#* If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=rank({\bf A})&amp;lt;n&amp;lt;/math&amp;gt; then the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt; generate a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-dimensional space, in which only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;n&amp;lt;/math&amp;gt; components of the the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; can be composed by linear combination of the the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}_{\bf j}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j =1,\ldots n&amp;lt;/math&amp;gt;. Therefore in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n-k&amp;lt;/math&amp;gt; unknowns can be freely selected and the system has infinite many solutions. Note that in this case &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \geq rank({\bf A})&amp;lt;/math&amp;gt;, so it can be also smaller than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The different cases of solvability and their criteria are summarized in Table [[#tab:solv_lse|1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:solv_lse&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Solvability criteria of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m \times n&amp;lt;/math&amp;gt; linear system of equations&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  Rank criterion  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   General case  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Special case  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Homogeneous system  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) \neq rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   No solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   - Not possible -  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Unique solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Only trivial solution  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Infinite many  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Also non-trivial  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions,  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   infinite many  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   unknowns can be  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   chosen freely &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   free parameters  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solvability - square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several further findings can be obtained for the special case of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt; then matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-singular and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) \neq 0&amp;lt;/math&amp;gt;. Otherwise matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is singular and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking all these into account the solvability conditions for the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; can be summarized in a slightly simplified form, which is shown in Table [[#tab:solv_lse_sm|2]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:solv_lse_sm&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Solvability criteria of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; linear system of equations&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  Rank criterion  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Inhomogeneous system &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  Homogeneous system &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;   &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) \neq 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Unique solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Only trivial solution  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;) &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf A}^{-1}{\bf b}&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} ={\bf 0}&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Infinite many  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  Also non-trivial  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;) and  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   solutions,  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) = rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   infinite many &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   unknowns can be  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-rank({\bf A}))&amp;lt;/math&amp;gt;  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   chosen freely  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   free parameters  &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A}) = 0&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   No solution  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   - Not possible -  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) &amp;lt; n&amp;lt;/math&amp;gt;) and  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*) \neq rank({\bf A})&amp;lt;/math&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|    &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;eigenvectors-eigenvalues-spectral-decomposition&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eigenvectors, eigenvalues, spectral decomposition ===&lt;br /&gt;
&lt;br /&gt;
For a given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; finding the scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times 1&amp;lt;/math&amp;gt; column vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; satisfying the equation&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf u} = \lambda{\bf u}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
called as eigenvalue problem of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. The scalars &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; satisfying the equation are called eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and the vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; satisfying the equation are called eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Transforming an eigenvector by multiplying it by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; gives a vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda{\bf u}&amp;lt;/math&amp;gt; being parallel to the considered eigenvector. Hence the transformation by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; does not change the direction of the eigenvectors and their length will be multiplied by the eigenvalue. This explains the names eigenvectors and eigenvalues.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Characteristic polynomial&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rearranging the above relation gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right) {\bf u} = {\bf 0}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is homogeneous system of linear equations, which has non-trivial solution only if the determinant of the coefficient matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right)&amp;lt;/math&amp;gt; is zero, in other words, if &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;det\left({\bf A}- \lambda {\bf I}\right)=0.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; arises in each element of the main diagonal of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda {\bf I}\right)&amp;lt;/math&amp;gt;. It follows that the permutation giving the products of the main diagonal and therefore also the determinant of this matrix is an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;. This &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is called the characteristic polynomial of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Its solutions give the eigenvalues. According to the fundamental theory of algebra, an &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-order polynomial has exactly &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; solutions in the set of complex numbers. It follows that there exist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; complex eigenvalues implying at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; real eigenvalues, from which some of them can arise more times.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algebraic multiplicity and geometric multiplicity&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, s&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \leq n&amp;lt;/math&amp;gt; denote the eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. The number of arising of the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; in the solution of the characteristic polynomial is called the algebraic multiplicity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;. For each &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; the homogeneous system&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left({\bf A}- \lambda_i {\bf I}\right) {\bf u} = {\bf 0}.&amp;lt;/math&amp;gt; determines the eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;. Due to the homogeneous character of the system, its solution must have at least one free parameter. This is manifested in the fact that any constant multiplication of an eigenvector is also a solution of a system. Hence an eigenvector is determined only up to a constant multiplication, i.e. only the direction (in the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-dimensional Euclidean system) of the eigenvector is determined, but its length not. The number of linearly independent eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; can be one or more depending on the rank of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left({\bf A}- \lambda_i {\bf I}\right)&amp;lt;/math&amp;gt;. In fact linearly independent eigenvectors belonging to the eigenvalue &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt; is the number of freely selectable parameter, which is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n-rank({\bf A}- \lambda_i {\bf I})&amp;lt;/math&amp;gt;, which is called the geometric multiplicity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; An example for determining eigenvalues an eigenvectors&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1-a &amp;amp; a \\&lt;br /&gt;
b &amp;amp; 1-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right), ~~ a,b \geq 0.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Computing the eigenvalues of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\lambda {\bf I} - {\bf A}| = \left(\lambda - (1 - a)\right)\left(\lambda - (1-b)\right)-ab = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda^2 - \lambda (1-a+1-b)+(1-a)(1-b)-ab =0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda^2 - \lambda (2-a-b)+1-a-b =0&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \lambda_{1,2} &amp;amp;= \frac{(2-a-b)\pm \sqrt{(2-a-b)^2-4(1-a-b)}}{2} \\&lt;br /&gt;
        &amp;amp;= \frac{(2-a-b)\pm \sqrt{4-4(a+b)+(a+b)^2-4+4(a+b)}}{2} \\&lt;br /&gt;
    &amp;amp;=\frac{(2-a-b)\pm(a+b)}{2}\\&lt;br /&gt;
    &amp;amp;\Rightarrow ~~ \lambda_1 = 1,~ \mathrm{(since~the~matrix~} {\bf A} \mathrm{~stochastic~is,)~and} \\&lt;br /&gt;
    &amp;amp;~~~ \lambda_2 = 1-a-b. &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Determining the eigenvectors of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&lt;br /&gt;
#* The eigenvector belonging to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1=1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;({\bf A} - {\bf I}) {\bf u}_{\bf 1} = {\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(&lt;br /&gt;
        \begin{array}{ll}&lt;br /&gt;
        -a &amp;amp; a \\&lt;br /&gt;
        b &amp;amp; -b  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) \left(&lt;br /&gt;
        \begin{array}{l}&lt;br /&gt;
        u_1  \\&lt;br /&gt;
        u_2  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) =\left( \begin{array}{l}&lt;br /&gt;
        0  \\&lt;br /&gt;
        0&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-a u_1 + a u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b u_1 - b u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1} =\left( \begin{array}{l}&lt;br /&gt;
        1  \\&lt;br /&gt;
        1&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
#* The eigenvector corresponding to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2= 1-a-b&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;({\bf A} - (1-a-b){\bf I}) {\bf u}_{\bf 2} = {\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(&lt;br /&gt;
        \begin{array}{ll}&lt;br /&gt;
        b &amp;amp; a \\&lt;br /&gt;
        b &amp;amp; a  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) \left(&lt;br /&gt;
        \begin{array}{l}&lt;br /&gt;
        u_1  \\&lt;br /&gt;
        u_2  &lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right) =\left( \begin{array}{l}&lt;br /&gt;
        0  \\&lt;br /&gt;
        0&lt;br /&gt;
        \end{array}&lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b u_1 + a u_2  = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
        1  \\&lt;br /&gt;
        \frac{-b}{a}&lt;br /&gt;
        \end{array} &lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;    or    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
        a  \\&lt;br /&gt;
        -b&lt;br /&gt;
        \end{array} &lt;br /&gt;
        \right)&amp;lt;/math&amp;gt;,  since the eigenvectors are only determined up to a multiplicative constant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Left and right eigenvalues and eigenvectors&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So far we considered the form of the eigenvalue problem, in which the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt; being a column vector and hence locates on the right side of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. From this reason this eigenvalue problem is also called as right eigenvalue problem, and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;-s and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}&amp;lt;/math&amp;gt;-s are also called as right eigenvalues and right eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
There is a similar eigenvalue problem, in which the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is a row vector and arises on the left hand side of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf v}{\bf A} = {\bf v}\lambda,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and it called as left eigenvalue problem. The solution &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt;-s and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf v}&amp;lt;/math&amp;gt;-s are also called as left eigenvalues and left eigenvectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
&lt;br /&gt;
The two kind of eigenvalue problem can be related by transposing them into each other. For example transposing the right eigenvalue problem gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf u}^T{\bf A}^T = {\bf u}^T\lambda.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows the relation between the two kind of eigenvalue problem, which can be formulated as follows. The right side eigenvalues and eigenvectors of square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; are the left side eigenvalues and eigenvectors of the transpose of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively. It follows that for a symmetric matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; the right and the left side eigenvalues and eigenvectors are the same, respectively, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}=&amp;lt;/math&amp;gt;&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;S&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;^T&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Properties of eigenvalues&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda({\bf A})&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda({\bf A})_i&amp;lt;/math&amp;gt; stands for the eigenvalues and the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th eigenvalue, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots,n&amp;lt;/math&amp;gt; of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;, respectively. Useful properties of the eigenvalues are given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{E1.~}\lambda(c{\bf A})= c \lambda({\bf A}) ~~ c \in \mathbb{R}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
&amp;amp;\mathrm{E2.~}\lambda({\bf A}^{-1}) = \left(\lambda{\bf A}\right)^{-1}\\&lt;br /&gt;
&amp;amp;\mathrm{E3.~}\prod_{i=1}^n \lambda({\bf A})_i = det({\bf A})&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The spectral decomposition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is a factorization into the canonical form as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}&amp;lt;/math&amp;gt; is a diagonal matrix. The spectral decomposition is also called eigendecomposition or diagonalisation.&lt;br /&gt;
&lt;br /&gt;
The matrices arising in the factorization can be interpreted as follows. The diagonal elements of the diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}&amp;lt;/math&amp;gt; are the right eigenvalues of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Note that each eigenvalue arises in the diagonal as many times as its algebraic multiplicity. The column vectors of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are the right eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_k&amp;lt;/math&amp;gt; eigenvalues, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=1,\ldots, n&amp;lt;/math&amp;gt;. Thus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_k&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; satisfies&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf u}_{\bf k} = {\bf u}_{\bf k} \lambda_k, ~~ k=1,\ldots, n,&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which can be arranged in matrix form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf U} = {\bf U}{\bf \Lambda}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the fact that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; is determined only up to a constant, does not influence the canonical form of the spectral decomposition. This can be seen by replacing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf k}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_k{\bf u}_{\bf k}&amp;lt;/math&amp;gt;, in matrix form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}{\bf C}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C}=diag(c_1,\ldots, c_n&amp;lt;/math&amp;gt;, in the canonical form, which leads to&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf U}{\bf C}{\bf \Lambda}\left({\bf U}{\bf C}\right)^{-1}= {\bf U}{\bf C}{\bf \Lambda}{\bf C}^{-1}{\bf U}^{-1}={\bf U}{\bf C}{\bf C}^{-1}{\bf \Lambda}{\bf U}^{-1} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where we utilized the commutativity of the diagonal matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf \Lambda}{\bf C}^{-1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; An example for spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continuing the the example for determining eigenvalues an eigenvectors of the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A} =  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1-a &amp;amp; a \\&lt;br /&gt;
b &amp;amp; 1-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right), ~~ a,b \geq 0,&amp;lt;/math&amp;gt; now we show the spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So far we have determined the right eigenvalues &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1 = 1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2 = 1-a-b&amp;lt;/math&amp;gt;, and the right eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1} =\left( \begin{array}{l}&lt;br /&gt;
1  \\&lt;br /&gt;
1&lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2} =\left( \begin{array}{l}&lt;br /&gt;
a  \\&lt;br /&gt;
-b&lt;br /&gt;
\end{array} &lt;br /&gt;
\right)&amp;lt;/math&amp;gt; belonging to them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Composition of diagonal matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; The diagonal elements of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; are the eigenvalues &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_2&amp;lt;/math&amp;gt;. Thus matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda&amp;lt;/math&amp;gt; is given by&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Lambda =\left(&lt;br /&gt;
   \begin{array}{ll}&lt;br /&gt;
   1 &amp;amp; 0\\&lt;br /&gt;
   0 &amp;amp; 1-a-b  &lt;br /&gt;
   \end{array}&lt;br /&gt;
   \right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Composition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; The columns of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are the eigenvectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf u}_{\bf 2}&amp;lt;/math&amp;gt;. Thus matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; is given as&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}  = \left(&lt;br /&gt;
   \begin{array}{ll}&lt;br /&gt;
   1 &amp;amp; a \\&lt;br /&gt;
   1 &amp;amp; -b  &lt;br /&gt;
   \end{array}&lt;br /&gt;
   \right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Determination of the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}  = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; a \\&lt;br /&gt;
1 &amp;amp; -b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}  = \frac{1}{\det {\bf U}} \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
-b &amp;amp; -a \\&lt;br /&gt;
-1 &amp;amp; 1  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \frac{1}{-(a+b)} \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
-b &amp;amp; -a \\&lt;br /&gt;
-1 &amp;amp; 1  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right) = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
\frac{b}{a+b} &amp;amp; \frac{a}{a+b} \\&lt;br /&gt;
\frac{1}{a+b} &amp;amp; \frac{-1}{a+b}  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;The spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}  = \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; a \\&lt;br /&gt;
1 &amp;amp; -b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1 &amp;amp; 0\\&lt;br /&gt;
0 &amp;amp; 1-a-b  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)  \left(&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
\frac{b}{a+b} &amp;amp; \frac{a}{a+b} \\&lt;br /&gt;
\frac{1}{a+b} &amp;amp; \frac{-1}{a+b}  &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Conditions for the existence of spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that not every square matrix is diagonalisable. Two useful conditions for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; to be diagonalisable can be given as&lt;br /&gt;
&lt;br /&gt;
# The spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; exists if and only if the number of linearly independent right eigenvectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; equals to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# A sufficient condition for the existence of spectral decomposition of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is that its characteristic polynomial has no repeated roots.&lt;br /&gt;
&lt;br /&gt;
Based on the first condition, the canonical form of the spectral decomposition can be derived. The column vectors of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; are linear independent, so it is non-singular and hence exists the inverse matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}&amp;lt;/math&amp;gt;. Multiplying the matrix form relation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf U} = {\bf U}{\bf \Lambda}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}^{-1}&amp;lt;/math&amp;gt; from right gives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf U}{\bf U}^{-1} = {\bf U}{\bf \Lambda}{\bf U}^{-1},&amp;lt;/math&amp;gt; from which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}{\bf U}^{-1} = {\bf I}&amp;lt;/math&amp;gt; falls out resulting the canonical form of the spectral decomposition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Application of spectral decomposition&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Spectral decomposition is used im many area of the natural sciences. Below we list several typical example for using spectral decomposition.&lt;br /&gt;
&lt;br /&gt;
# Calculating a power of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^k = \left({\bf U}{\bf \Lambda}{\bf U}^{-1}\right)^k = {\bf U}{\bf \Lambda}^k{\bf U}^{-1},~~ k \in \mathbb{N^+}.&amp;lt;/math&amp;gt;&lt;br /&gt;
# Expressing the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}^{-1} = {\bf U}{\bf \Lambda}^{-1}{\bf U}^{-1},~~ \mathrm{~which~can~be~obtained~by~taking~inverse~of~canonical~form~}.&amp;lt;/math&amp;gt; Such expression of the inverse of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; exists if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i \neq 0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots, n&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Expressing matrix function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf A})&amp;lt;/math&amp;gt; of matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf A})&amp;lt;/math&amp;gt; defined by the help of power series of f() &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
        f({\bf A}) = {\bf U}f({\bf \Lambda}){\bf U}^{-1},~~ &amp;amp;\mathrm{~which~can~be~shown~by~using~power~series~form~of~}f({\bf A})\\&lt;br /&gt;
        &amp;amp;\mathrm{~and~above~relation~for~}{\bf A}^k.&lt;br /&gt;
     &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Showing the convergence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_n^{\infty}{\bf A}^n&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
        \sum_n^{\infty}{\bf A}^n,~~ &amp;amp;\mathrm{~convergent~is,~when~} |\lambda_i|&amp;lt; 1,\mathrm{~for~}i=1,\ldots,n.&lt;br /&gt;
     &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;matrix-norms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Matrix norms ===&lt;br /&gt;
&lt;br /&gt;
Eigenvalues can be considered to be a set of numbers characterizing the magnitude of a square matrix. Often the eigenvalue with the highest magnitude has outstanding importance. Besides of it, there is a need for characterising the magnitude of a square matrix only by one number, analogously to the absolute value of a real or complex number.&lt;br /&gt;
&lt;br /&gt;
The matrix norm is a measure characterizing the magnitude of a square matrix by one number. The matrix norm is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|~~ \right\|&amp;lt;/math&amp;gt;, e.g. the norm of the square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\|&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Definition of several matrix norms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the contrary to the uniqueness of the absolute value, more matrix norms can be defined. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; be the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. Then several martix norms can be given as&lt;br /&gt;
&lt;br /&gt;
# Max norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = n\max_{i,j} |a_{ij}|.&amp;lt;/math&amp;gt; Note that there is another, similar norm which is also called as max norm.&lt;br /&gt;
# Max row sum &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = \max_{i}\sum_{j} |a_{ij}|.&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L1&amp;lt;/math&amp;gt; norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left\|{\bf A} \right\| = \sum_{i}\sum_{j} |a_{ij}|.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; General properties of matrix norms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Matrix norms are useful tools e.g. in theoretical derivations, like e.g. to prove the existence of an upper limit. In fact in most of the cases the concrete form of the matrix norm is not interesting. Instead some properties of the matrix norm are utilized. These important general properties of matrix norm are listed for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{N1.~}\left\|{\bf A} \right\| \geq 0.\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\mathrm{N2.~}\left\|c{\bf A} \right\| = c \left\|{\bf A} \right\| ~~ ~~ c \in \mathbb{R}.\\&lt;br /&gt;
    &amp;amp;\mathrm{N3.~}\left\|{\bf A} \right\| + \left\|{\bf B} \right\| \geq \left\|{\bf A} + {\bf B} \right\| \mathrm{~-~triangle~ inequality~}. \\&lt;br /&gt;
    &amp;amp;\mathrm{N4.~}\left\|{\bf 0} \right\| = 0. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Useful matrix norms also have the following additional property &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\mathrm{N5.~}\left\|{\bf A} {\bf B} \right\| \leq \left\|{\bf A} \right\| \left\|{\bf B} \right\|\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
All the three above defined matrix norms have this additional property. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{ij}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_{jk}&amp;lt;/math&amp;gt; be the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j,k&amp;lt;/math&amp;gt;-th element of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, respectively . Then the additional property can be shown for these matrix norms as follows.&lt;br /&gt;
&lt;br /&gt;
# Max norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= n\max_{i,k} |\sum_{j} a_{ij}b_{jk}| \leq n\max_{i,k} \sum_{j} |a_{ij}| |b_{jk}| \\&lt;br /&gt;
    &amp;amp;\leq n^2 \max_{i,j} |a_{ij}|\max_{j,k} |b_{jk}| = n\max_{i,j} |a_{ij}|n\max_{j,k} |b_{jk}| = \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Max row sum &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= \max_{i}\sum_{k}  |\sum_{j} a_{ij}b_{jk}|\leq  \max_{i} \sum_{j} |a_{ij}| \sum_{k}|b_{jk}| \\&lt;br /&gt;
    &amp;amp;\leq  \max_{i} \sum_{j} |a_{ij}| \left(\max_{j} \sum_{k}|b_{jk}| \right)= \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L1&amp;lt;/math&amp;gt; norm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left\|{\bf A} |{\bf B}\right\| &amp;amp;= = \sum_{i}\sum_{k} |\sum_{j} a_{ij}b_{jk}| \leq \sum_{i}\sum_{k} \sum_{j} |a_{ij}| |b_{jk}| \\&lt;br /&gt;
    &amp;amp;= \sum_{i} \sum_{j} |a_{ij}|\sum_{k} |b_{jk}| \leq \sum_{i} \sum_{j} |a_{ij}|\left\|{\bf B} \right\| = \left\|{\bf A} \right\| \left\|{\bf B} \right\|.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several typical applications of matrix norms are given below.&lt;br /&gt;
&lt;br /&gt;
* To show that a norm of a matrix expression is upper limited.&lt;br /&gt;
* To show that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lim_{n \rightarrow \infty } {\bf A}^n = {\bf 0}&amp;lt;/math&amp;gt;, when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\| &amp;lt; 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* To show that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{n=0}^{\infty} {\bf A}^n&amp;lt;/math&amp;gt; convergent is, when &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left\|{\bf A} \right\| &amp;lt; 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;application-of-linear-algebra&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Application of linear algebra ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solving-system-of-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solving system of equations ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; System of linear equations&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the system of linear equations with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; equations, i.e. with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n \times n&amp;lt;/math&amp;gt; square matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;. This system of linear equations can be written in matrix vector form as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf b}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Inhomogeneous system with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=n&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the case with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt;, which is an important subclass of system of linear equations. Then there is always a unique solution, since the rank can not be changed via extending &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^*&amp;lt;/math&amp;gt;, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}^*)=\min(n, n+1)= n&amp;lt;/math&amp;gt;. The solution can be given in closed form by multiplying the matrix vector equation by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}^{-1}&amp;lt;/math&amp;gt; from left, which gives the closed form solution as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} ={\bf A}^{-1}{\bf b}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the inverse matrix exists in this case, since matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is non-singular due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Homogeneous system with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A})=(n-1)&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recall that the equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}adj({\bf A}) = det({\bf A}){\bf I}&amp;lt;/math&amp;gt; holds for the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=0&amp;lt;/math&amp;gt; then this leads to &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf A}adj({\bf A}) = {\bf 0}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; denotes the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th column vector of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots,n&amp;lt;/math&amp;gt;. It follows that any column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; is a solution of the homogeneous equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;det({\bf A})=0&amp;lt;/math&amp;gt;. If additionally &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt;, then there is only one free parameter. Since any constant multiplication of a column vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\left(adj({\bf A})\right)_{i}&amp;lt;/math&amp;gt; is also a solution, it follows that&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \left(adj({\bf A})\right)_{1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \in \mathbb{R}&amp;lt;/math&amp;gt; gives every solution of the homogeneous equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}{\bf x} ={\bf 0}&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt; and&lt;br /&gt;
* the columns of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;adj({\bf A})&amp;lt;/math&amp;gt; are constant multiplications of each other if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;rank({\bf A}) = (n-1)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; System of non-linear equations&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let us consider the following system of non-linear equations with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; unknowns and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; equations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;f_1(x_1,\ldots,x_n) = 0 \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
&amp;amp;f_n(x_1,\ldots,x_n) = 0 \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Introducing the notations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x} =\left(&lt;br /&gt;
    \begin{array}{l}&lt;br /&gt;
    x_1 \\&lt;br /&gt;
    \vdots \\&lt;br /&gt;
    x_n &lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf g}({\bf x}) =\left(&lt;br /&gt;
\begin{array}{l}&lt;br /&gt;
f_1(x_1,\ldots,x_n) \\&lt;br /&gt;
\vdots \\&lt;br /&gt;
f_n(x_1,\ldots,x_n) = 0 &lt;br /&gt;
\end{array}&lt;br /&gt;
\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this can be rewritten as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf g}({\bf x}) ={\bf 0}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Solving of this system of non-linear equations is equivalent with minimization problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{\bf x} {\bf F}({\bf x}) = \arg \min_{\bf x}\frac{1}{2}{\bf g}^T({\bf x}) {\bf g}({\bf x}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since the square of each element in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}({\bf x})&amp;lt;/math&amp;gt; is non-negative. The gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}({\bf x}&amp;lt;/math&amp;gt; can be expressed as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}} {\bf F}({\bf x}) = \nabla_{{\bf x}}\left( \frac{1}{2}{\bf g}^T({\bf x}) {\bf g}({\bf x}) \right) = {\bf J}_{{\bf g}}^T({\bf x}){\bf g}({\bf x}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf J}_{{\bf g}}^T({\bf x})&amp;lt;/math&amp;gt; is the Jacobian matrix of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}({\bf x})&amp;lt;/math&amp;gt;. Then the minimization problem can be solved numerically by applying the gradient descent algorithm. This can be executed by initializing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{0} = {\bf 0}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and performing the iterative steps&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}- \gamma_k {\bf J}_{{\bf g}}^T({\bf x}_{k}){\bf g}({\bf x}_{k}),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; is the step size and can be determined by any of the line search methods (see in [[#sssec:grad_meth|3.2.3]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;numeric-optimization&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Numeric optimization  ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;sssec:grad_meth&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Gradient methods ===&lt;br /&gt;
&lt;br /&gt;
The gradient methods are numeric methods for unconstrained mathematical optimization. They can be applied to differentiable multivariate functions. They are usually formulated as finding the minimum of a multivariate function. All of them use the gradient of the multivariate function, this explains the name.&lt;br /&gt;
&lt;br /&gt;
The basic idea of gradient methods is to decrease the function value in each step of the algorithm. It is well known that at the given point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x_0} \in \mathbb{R}^N&amp;lt;/math&amp;gt; of the multivariate function, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(&amp;lt;/math&amp;gt;&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;x&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;):\mathbb{R}^N \rightarrow \mathbb{R}&amp;lt;/math&amp;gt;, the infinitesimal difference in the function value is the highest in the direction of the gradient at that point, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt;. Therefore the steepest decent is in the opposite direction of the gradient. The iterative step of any gradient methods takes a step in a direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; which is related to the negative gradient at the current point, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;- \nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt;. The step size is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt;. Hence the iterative step of any gradient methods can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1}= {\bf x}_{k} + \gamma_k {\bf d}_k.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that both the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; and the vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; can depend on the iteration step.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Requirements and conditions to decrease the function value in each iteration&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to decrease the function value in each step, two requirements must be made.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.1}&amp;lt;/math&amp;gt; It must be ensured that the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; infinitesimally shows into a descent direction.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; The step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; must be enough small to avoid overshooting the nearest local minimum and thus to avoid leading to divergence.&lt;br /&gt;
&lt;br /&gt;
The first requirement is equivalent with showing that the negative gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;- \nabla_{{\bf x}}f({\bf x}_0)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; and vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt; lie on the same side of the hyperplane being perpendicular to the gradient. In this case their scalar product is positive. This leads to the condition &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C.1}&amp;lt;/math&amp;gt; ensuring &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.1}&amp;lt;/math&amp;gt; as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf C.1} \mathrm{~~~~} \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k &amp;lt; 0  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second requirement can be fulfilled by formalising &amp;amp;quot;enough small&amp;amp;quot; by specifying a demanded amount of decrease in function value. This is done by the Armijo condition demanding that the decrease in function value should be at least proportional to the product of the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; and the directional derivative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k&amp;lt;/math&amp;gt;. Hence the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; can be fulfilled by condition &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf C.2}&amp;lt;/math&amp;gt;, which is the Armijo condition and given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf C.2} \mathrm{~~}\mathrm{~~Armijo~condition~~} f({\bf x}_k + \gamma_k  {\bf d}_k) - f({\bf x}_k)  \leq  \delta \gamma_k \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k \mathrm{~~~~~~~~~~~~~~~},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; is the constant of proportionality. In the practice usually &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; is set to small values, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;10^{-4}&amp;lt;/math&amp;gt;. Observe that on both sides of this inequality there are negative values.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Determination of the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the step size were set to too small then the convergence would become too slow. This leads to a third requirement as&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt; The step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; must be enough large to avoid slowing the convergence. The requirements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt; together ensure an optimal step size.&lt;br /&gt;
&lt;br /&gt;
The three most important search methods for determining the optimal step size are&lt;br /&gt;
&lt;br /&gt;
* Exact line search&lt;br /&gt;
* Inexact line search&lt;br /&gt;
* Backtracing line search&lt;br /&gt;
&lt;br /&gt;
The exact line search determines the optimal step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; by minimizing the function value after taking the next step. This leads to a one-dimensional minimization problem as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{\gamma_k} g(\gamma_k) = \arg \min_{\gamma_k} f({\bf x}_k + \gamma_k  {\bf d}_k).&amp;lt;/math&amp;gt; The exact line search are used only seldom in practice due to its high computing effort.&lt;br /&gt;
&lt;br /&gt;
In the inexact line search the step size, starting from an initial value, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, is iteratively decreased until the function value after the step will be less than the current one, in other words until &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f({\bf x}_{k+1}) = f({\bf x}_k + \gamma_k  {\bf d}_k) &amp;lt;  f({\bf x}_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The backtracing line search searches for &amp;amp;quot;enough small&amp;amp;quot; step size by utilizing the Armijo condition. Starting from an initial step size, the step size is iteratively multiplied by a properly selected constant of proportionality, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\delta&amp;lt;/math&amp;gt; until the Armijo condition fulfils.&lt;br /&gt;
&lt;br /&gt;
While exact line search fulfils both requirements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.3}&amp;lt;/math&amp;gt;, inexact line search fulfils only &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf R.2}&amp;lt;/math&amp;gt; and backtracing line search lies somewhere in between. Because of this and its simplicity, it is often used in the practice.&lt;br /&gt;
&lt;br /&gt;
The pseudo-code of an algorithm for gradient method with backtracing line search can be seen in Algorithm 9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 9 Gradient method - with backtracing line search&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Compute vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
   —– Backtracing line search - begin —&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Init backtracing line search &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k=1&amp;lt;/math&amp;gt;, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0 &amp;lt; \delta &amp;lt; 1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_k + \gamma_k  {\bf d}_k) - f({\bf x}_k) &amp;gt;  \delta \gamma_k \nabla_{{\bf x}}f({\bf x}_k)^T {\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k = \delta \gamma_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
9    end&amp;lt;br /&amp;gt;&lt;br /&gt;
   —– Backtracing line search - end —-&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  + \gamma_k {\bf d}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11   end&amp;lt;br /&amp;gt;&lt;br /&gt;
12   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; The gradient descent&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The gradient descent algorithm is a special case of the gradient methods by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; to be the steepest descent, in other words &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt;. Thus gradient descent is a first-order method and its iterative step can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1}= {\bf x}_{k} - \gamma_k \nabla_{{\bf x}}f({\bf x}_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the context of deep learning the step size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma&amp;lt;/math&amp;gt; is also called as learning rate. The pseudo-code of the gradient descent algorithm is given in Algorithm 10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 10 Gradient descent algorithm&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Update learning rate by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  - \gamma_k \nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    end&amp;lt;br /&amp;gt;&lt;br /&gt;
8    return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The convergence to local minimum can be guaranteed under certain assumptions on function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; and specific choice s of the dependency of learning rate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k&amp;lt;/math&amp;gt; on &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_k&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k-1}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_k)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k-1})&amp;lt;/math&amp;gt;. If function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; is convex, then local minimum is also the global minimum.&lt;br /&gt;
&lt;br /&gt;
The extension of gradient descent, the stochastic gradient descent algorithm and its improved variants are the most commonly used numeric optimization algorithms for training deep neural networks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Further special cases of gradient methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several further algorithm can be obtained as special cases of gradient methods by setting vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt; specially. These includes&lt;br /&gt;
&lt;br /&gt;
* Diagonal scaled gradient descent and&lt;br /&gt;
* Newton’s method.&lt;br /&gt;
&lt;br /&gt;
The diagonal scaled gradient descent algorithm is obtained by setting&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -{\bf D}\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;={\bf D}= diag(d_1,\ldots,d_L)&amp;lt;/math&amp;gt; is a diagonal matrix. Note that just like vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d}&amp;lt;/math&amp;gt;, matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; can also depend on the iteration step.&lt;br /&gt;
&lt;br /&gt;
The Newton’s method, also called as Newton–Raphson method applied to optimization can be also obtained by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf d} = -{\bf D}\nabla_{{\bf x}}f({\bf x})&amp;lt;/math&amp;gt; with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = {\bf H}_f^{-1}&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf H}_f^{-1}= \nabla_{{\bf x}}^2 f({\bf x})&amp;lt;/math&amp;gt; is the Hessian matrix. Since the Hessian matrix includes second order derivatives of function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;, Newton’s method is a second order optimization method. For the class of convex functions the Newton’s method converges to the minimum quadratically fast.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;second-order-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Second-order algorithms ===&lt;br /&gt;
&lt;br /&gt;
The second-order algorithms use the second order information in their original formulation from the Hessian matrix. The following second-order methods are considered&lt;br /&gt;
&lt;br /&gt;
* Newton’s method&lt;br /&gt;
* Quasi-Newton methods&lt;br /&gt;
* Non-linear conjugate gradient algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Newton methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Newton’s method for local optimization is based on the second order Taylor-expansion of the function to be optimized. We apply it to minimize the function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;. The second order Taylor-expansion of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; around &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k}&amp;lt;/math&amp;gt; is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f({\boldsymbol{x}}) \approx f({\bf x}_{k}) + ({\bf x} - {\bf x}_{k})^T \nabla_{{\bf x}}f({\bf x}_{k}) + \frac{1}{2}({\bf x} - {\bf x}_{k})^T  {\bf H}_f({\bf x}_{k}) ({\bf x} - {\bf x}_{k}).&amp;lt;/math&amp;gt; The method chooses the next value of the parameter vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; as the minimum of the above Taylor-expansion form. It is well known that the necessary condition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; being the minimum is that the gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; must be &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf 0}&amp;lt;/math&amp;gt;. Computing the gradient of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt; with respect to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; and setting it to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf 0}&amp;lt;/math&amp;gt; gives &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}) = \nabla_{{\bf x}}f({\bf x}_{k}) + {\bf H}_f({\bf x}_{k}) ({\bf x} - {\bf x}_{k}) = {\bf 0},&amp;lt;/math&amp;gt; from which the next value of the parameter vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; can be expressed by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x} = {\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k} - {\bf H}_f^{-1}({\bf x}_{k})\nabla_{{\bf x}}f({\bf x}_{k}),&amp;lt;/math&amp;gt; which is the same formula as we got by setting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D} = {\bf H}_f^{-1}&amp;lt;/math&amp;gt; in the general iteration relation of the gradient methods. This recursive computational rule utilizes also the second order information in Hessian matrix. If the function to be minimized is locally quadratic then the method jumps in one step to the minimum. Otherwise it iterates in quadratic steps and hence faster than the gradient descent. There are two major issues with the Newton’s method as&lt;br /&gt;
&lt;br /&gt;
# Limitation - The convergence of the method is ensured only for locally convex regions. It can move in wrong direction near a saddle point.&lt;br /&gt;
# Drawback - The numerical complexity of the method is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^3)&amp;lt;/math&amp;gt;, that is higher than that of the first-order methods. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of parameters, i.e. the size of vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt;. This is due to the computation of the inverse Hessian in each iteration step.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quasi-Newton methods&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In many applications, like e.g. in machine learning and in deep learning trainings, the the number of parameters, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is usually in magnitude of thousands and millions. Therefore Newton’s method can not be applied directly due to its numerical complexity in such applications.&lt;br /&gt;
&lt;br /&gt;
Instead the quasi-Newton methods can be applied, in which the Hessian matrix is approximated by the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;, which needs much less computation effort. The matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; is chosen to satisfy the so called secant equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}) = \nabla_{{\bf x}}f({\bf x}_{k}) + {\bf B}({\bf x}_{k}) ({\bf x} - {\bf x}_{k}),&amp;lt;/math&amp;gt; This leads to a significant reduction in the computational complexity.&lt;br /&gt;
&lt;br /&gt;
The most prominent quasi-Newton method is the&amp;lt;br /&amp;gt;&lt;br /&gt;
Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm. It uses the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; only for determining the search direction, but it does not apply the quadratic step size like in the original Newton’s method. Instead a line search is performed. If the function is not convex then the step size is determined by finding a point satisfying the [https://en.wikipedia.org/wiki/Wolfe_conditions Wolfe conditions]. The numerical complexity of the BFGS algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^2)&amp;lt;/math&amp;gt;. However the algorithm stores the matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt; in each iteration step leading to the memory need &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N^2)&amp;lt;/math&amp;gt;. This makes it not appropriate for using in DL.&lt;br /&gt;
&lt;br /&gt;
A further improvement of BFGS is the Limited Memory BFGS (L-BFGS), whose memory need is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(1)&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(N)&amp;lt;/math&amp;gt; depending on the amount of information used from previous iteration at updating matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf B}&amp;lt;/math&amp;gt;. The method converges faster in locally convex environment than in a non-convex one.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Non-linear conjugate gradient algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One potential problem of gradient descent algorithm, that in narrow valley it takes a zig-zag route, which slows the convergence. This is because the consecutive gradients are orthogonal and therefore some part of progress already achieved in the previous gradient direction will be undo.&amp;lt;br /&amp;gt;&lt;br /&gt;
The conjugate gradient algorithm overcomes this problem by selecting the consecutive directions being so called conjugate gradient directions. In case of N-dimensional quadratic function it reaches the minimum exactly after &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; steps, since it does not undo progress made in previous directions. The next direction is determined as the linear combination of the actual gradient and the actual direction, in which the previous direction is weighted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;. Since the next and actual directions are conjugate gradients, the next direction can be determined on straightforward way by the help of the eigenvectors of the Hessian of the multivariate function to be minimized. The conjugate gradient algorithm was intended to solve a quadratic minimization problem, which is equivalent with solving a system of linear equations.&lt;br /&gt;
&lt;br /&gt;
The non-linear conjugate gradient algorithm is a generalization of the conjugate gradient algorithm to find a minimum of any non-linear multivariate function. In this case the algorithm does not stop after &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; steps, so a small modification is required in order to restart search eventually in the direction of unaltered gradient. This is performed by periodic reset of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. In case of large &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;, which is the case of e.g. in training deep learning models, the computation of the Hessian matrix requires a high computational effort. Therefore computationally more efficient ways were proposed to compute parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;. Two of the best known formulas for computing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; are given as follows:&lt;br /&gt;
&lt;br /&gt;
* Fletcher-Reeves formula: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\beta_k^{FR} = \frac{\nabla_{{\bf x}}^Tf({\bf x}_{k}) \nabla_{{\bf x}}f({\bf x}_{k})}{\nabla_{{\bf x}}^Tf({\bf x}_{k-1}) \nabla_{{\bf x}}f({\bf x}_{k-1})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
* Polak-Ribiere formula: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\beta_k^{PR} = \frac{\nabla_{{\bf x}}^Tf({\bf x}_{k}) \left(\nabla_{{\bf x}}f({\bf x}_{k})- \nabla_{{\bf x}}f({\bf x}_{k-1})\right)}{\nabla_{{\bf x}}^Tf({\bf x}_{k-1}) \nabla_{{\bf x}}f({\bf x}_{k-1})}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pseudo-code of the algorithm is given in Algorithm 11.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 11 Non-linear conjugate gradient algorithm&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs: - multivariate function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- initial value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- precision value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Outputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- found local minimum place &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_m&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
- local minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_m)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k=-1&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{-1})= \infty)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize conjugate direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf s}_{-1} ={\bf 0}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|f({\bf x}_{k}) - f({\bf x}_{k+1})| &amp;gt; \epsilon&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =k+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    Compute gradient &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\nabla_{{\bf x}}f({\bf x}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Update conjugate direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf s}_k = -\nabla_{{\bf x}}f({\bf x}_k) + \beta_k {\bf s}_{k-1}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Perform line search &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma_k = \arg\min_{\gamma} f({\bf x}_k + \gamma {\bf s}_k)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1} = {\bf x}_{k}  + \gamma_k {\bf s}_k&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
9 end&amp;lt;br /&amp;gt;&lt;br /&gt;
10 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{k+1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f({\bf x}_{k+1})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Quasi-Newton methods converge potentially much faster than the non-linear conjugate gradient algorithm.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6525</id>
		<title>Metrics in Data Science</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6525"/>
		<updated>2025-03-11T22:21:17Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;metrics-in-data-science&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Metrics in Data Science  =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-classification&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for classification ==&lt;br /&gt;
&lt;br /&gt;
A classification model is evaluated on the test data. The common metrics used to evaluate the model are listed as&lt;br /&gt;
&lt;br /&gt;
* Accuracy,&lt;br /&gt;
* Confusion matrix,&lt;br /&gt;
* Precision and Recall,&lt;br /&gt;
* Sensitivity and Specificity,&lt;br /&gt;
* F1Score and weighted F1,&lt;br /&gt;
* ROC curve and AUC ROC.&lt;br /&gt;
&lt;br /&gt;
Accuracy is the ratio of correctly classified examples to the total number of examples in the test set. Defining true examples (TE) and false examples (FE) the number of correctly and incorrectly classified examples in the test set, accuracy can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TE}{TE+FE}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The confusion matrix is a metric to visualize the classification performance. The rows of the matrix represent the true classes and the columns shows the predicted classes or vice versa. Both versions are used and can be found in the literature. Here we use the first version. The element (i,j) of the matrix shows the number of test examples belonging to class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and classified as class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;. Thus besides showing the number of correctly classified examples for each class, the confusion matrix gives an idea of typical missclassifications the model makes. An example confusion matrix can be seen in Figure [[#fig:exa_conf_matrix|16]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_conf_matrix&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/EvalMetric_ConfMatrExa.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 were originally introduced for binary classification models, but their usage can be extended to multiclass case. Therefore they will be defined and explained first for binary classification model.&lt;br /&gt;
&lt;br /&gt;
In terms of binary classification with positive and negative classes, the outcome of the classification task can fall in one of four cases: correctly/incorrectly classified examples belonging to positive/negative class. The prediction is true positive (TP) when a positive example is correctly classified, like e.g. presence of a disease. A false negative (FN) prediction occurs when a positive example is classified by the model as would belong to negative class. Similarly a true negative (TN) prediction occurs when a negative example is correctly classified. Finally the prediction is false positive (FP) when a negative example is classified as would belong to positive class. These cases are summarized in Table [[#tab:poss_predictions|8]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:poss_predictions&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Possible cases of the outcome of the classification task (=prediction)&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| predicted &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\backslash&amp;lt;/math&amp;gt; true  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   positive  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| positive  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true positive (TP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false positive (FP)&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| negative  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false negative (FN)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true negative (TN)&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For the case of binary classification the definition of Accuracy can be given alternatively as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TP+TN}{TP+TN+FP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The terms TP, FN, TN and FP are also used to denote the number of corresponding cases, e.g. TP also denotes the number of true positives.&lt;br /&gt;
&lt;br /&gt;
Precision is the ratio of the correctly classified positive examples to the total number of examples classified as positive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Precision} = \frac{TP}{TP+FP}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In contrast to that Recall is the ratio of the correctly classified positive examples to the total number of positive examples: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Recall} = \frac{TP}{TP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The measures sensitivity and specificity are also commonly used, especially in the healthcare.&lt;br /&gt;
&lt;br /&gt;
Sensitivity is the True Positive Rate (TPR), i.e. the proportion of captured trues and hence it equals to recall. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Sensitivity} = \mathrm{TPR} = \frac{TP}{TP+FN}  = \mathrm{Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specificity is the proportion of the captured negatives, i.e. True Negative Rate (TNR). &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Specificity} = \frac{TN}{TN+FP}.&amp;lt;/math&amp;gt; It follows that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt; is the False Positive Rate (FPR), i.e. proportion of not captured negatives, which is needed to define the ROC curve (see below).&lt;br /&gt;
&lt;br /&gt;
The F1Score is a harmonic mean of precision and recall and therefore it is a number between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{F1Score} =  F_1  = 2*\frac{Precision*Recall}{Precision+Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:use_metrics&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ The usage of the different metrics.&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Metric  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   When to use ?  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Accuracy  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   In case of classification problem&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with balanced classes.  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Precision  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to be sure about the&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   positive prediction to avoid any negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   consequences, like e.g in case of decrease&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   of credit limit to avoid customer dissatisfaction.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Recall  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to capture positive even&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with low probability, like e.g. to predict&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   whether a person has illness or not.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Sensitivity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TPR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured positives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Specificity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TNR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured negatives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| F1Score  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When both Precision and Recall are important.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| weighted F1 metric  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When importance of Precision and Recall&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   against each other can be characterized&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   by weights explicitly .&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| ROC curve  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used for determining probability threshold&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   for deciding the output class of the task,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   see Figure x.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| AUC ROC  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used to determine how well the positive class&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   is separated from the negative class.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The weighted F1 metric is a refined version of F1Score, in which Precision and Recall can have different weights. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{ weighted F1} = F_{\beta} = (1+ \beta^2)*\frac{Precision*Recall}{\beta^2 *Precision+Recall},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where Recall has weight &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta^2&amp;lt;/math&amp;gt; is the weight of Precision.&lt;br /&gt;
&lt;br /&gt;
In a multi-class setting the metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 metric are calculated first for each class individually and then averaged. This way they quantify the overall classification performance.&lt;br /&gt;
&lt;br /&gt;
The metrics ROC curve and AUC ROC are defined for binary classification task. The Receiver Operating Characteristic (ROC) curve is the True Positive Rate (=Sensitivity) as a function of the False Positive Rate (= &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt;). The Area Under Curve ROC is called AUC ROC. It indicates how well the positive class is separated from the negative class.&lt;br /&gt;
&lt;br /&gt;
The usage of the different metrics are summarized in the Table [[#tab:use_metrics|9]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:ill_ROC_curve&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/ROC_curve.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Depending on the use case strict, optimal or lenient (= moderate or high) probability threshold can be selected on the ROC curve. This is illustrated in Figure [[#fig:ill_ROC_curve|17]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-regression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for regression ==&lt;br /&gt;
&lt;br /&gt;
The common metrics used for evaluating regression models are are listed here.&lt;br /&gt;
&lt;br /&gt;
* Mean Squared Error (MSE),&lt;br /&gt;
* Root Mean Squared Error (RMSE)&lt;br /&gt;
* Mean Absolute Error (MAE),&lt;br /&gt;
* Mean Absolute Percentage Error (MAPE),&lt;br /&gt;
* Coefficient of Determination (COD), R-squared (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt;),&lt;br /&gt;
* modified R-squared,&lt;br /&gt;
&lt;br /&gt;
The Mean Squared Error (MSE) is one of the basic statistic used to evaluate the quality of a regression model. It is the average of the squares of the difference between the real and predicted values, in other words:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MSE} = \frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2.&amp;lt;/math&amp;gt; Less the MSE, better the regression model fits the real values.&lt;br /&gt;
&lt;br /&gt;
A similar measure is the Root Mean Squared Error (RMSE), which is the square root of MSE and thus it is biven as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{RMSE} = \sqrt{\frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2}.&amp;lt;/math&amp;gt; RMSE is a measure in the same units as the considered variable, which makes it a commonly used measure.&lt;br /&gt;
&lt;br /&gt;
The Mean Absolute Error (MAE) is the average absolute difference between the real and predicted values. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAE} = \frac{1}{K}\sum_{k}|y_k - \hat{y}_k|&amp;lt;/math&amp;gt; A nice property of MAE, that it is less likely influenced by extreme values. It is a common measure used in time series analysis as forecast error.&lt;br /&gt;
&lt;br /&gt;
The mean absolute percentage error (MAPE) quantifies the average of the ratio of the average absolute difference between the real and predicted values to the real value as a percentage. Hence the formula of MAPE can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAPE} = 100 \frac{1}{K}\sum_{k}|\frac{y_k - \hat{y}_k}{y_k}|&amp;lt;/math&amp;gt; MAPE is is commonly used for evaluating regression models and it is an appropriate metric where the scale of the considered value varies in a broad range. Intuitively it can be interpreted as a kind of relative error. This makes it also suitable to be used as a loss function as an objective in the optimization in regression problems.&lt;br /&gt;
&lt;br /&gt;
The metric Coefficient of Determination (COD) is also referred as R-squared and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r^2&amp;lt;/math&amp;gt; and pronounced as &amp;amp;quot;R-squared&amp;amp;quot;. The coefficient of determination determines the predictable proportion of the variation in the dependent variable, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{y}&amp;lt;/math&amp;gt; denote the mean of the output values, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{y} = \frac{1}{K} \sum_{k} y_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coefficient of determination is defined in terms of residual sum of squares, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{res}}&amp;lt;/math&amp;gt; and total sum of squares (related to the variance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{tot}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    SS_{\mathrm{res}} &amp;amp;= \sum_{k} ( y_k - \hat{y}_k)^2, \\&lt;br /&gt;
    SS_{\mathrm{tot}} &amp;amp;= \sum_{k} ( y_k - \bar{y}_k)^2&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}.&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; as metric quantifies the predictable proportion of the variation in the dependent variable. Its value falls between 0 and 1 with greater values indicating better regression fit.&lt;br /&gt;
&lt;br /&gt;
The metric modified (or adjusted) R-squared is introduced to compensate that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; increases when the dimension &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; becomes higher. Denoting the dimension of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;, the modified R-squared, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{R}^2&amp;lt;/math&amp;gt; is defined as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{R}^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}\frac{K-1}{K-N-1} = 1 -(1-R^2)\frac{K-1}{K-N-1}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metricS for KG ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quality-of-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Quality of KG ===&lt;br /&gt;
&lt;br /&gt;
The two most important quality measures of a KG are&lt;br /&gt;
&lt;br /&gt;
* completeness and&lt;br /&gt;
* accuracy.&lt;br /&gt;
&lt;br /&gt;
The completeness refers to evaluate the amount of existing triplets in the KG, while accuracy targets to measure the amounts of correct and incorrect triplets in the KG. After KG completion the resulted extraction graph is considered to be not yet a ready KG. Therefore quality measurement of KG is relevant only after KG refinement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-kg-refinement&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for KG refinement ===&lt;br /&gt;
&lt;br /&gt;
Usually completeness is measured in recall, precision and F-measure.&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, i.e. the amounts of correct and incorrect triplets is evaluated in terms of accuracy and alternatively, or in addition by means of AUC (i.e. the area under the ROC curve).&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; can be also based on the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt;, which can be assigned by human e.g. based on random sampling. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mu(\mathcal{G}) = \frac{1}{|\mathcal{T}|} \sum_{t \in \mathcal{T}} \mathbf{1}_{\{t\}},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{1}_{\{t\}}&amp;lt;/math&amp;gt; is the indicator variable indicating the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; otherwise taking the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In case of human judging, the usual evaluation metric is accuracy or precision together with the total number of judged triplets and errors found.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-link-prediction-with-kg-embeddings&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for link prediction with KG embeddings ===&lt;br /&gt;
&lt;br /&gt;
The used evaluation metric for link prediction with KG embeddings depends on the subtask of link prediction, see in Table [[#tab:Eval_metr_subt_LP|10]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:Eval_metr_subt_LP&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Evaluation metric for subtasks of link prediction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Subtask&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Evaluation metrics&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   rank based measures&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity type prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Macro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt; and Micro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Triple classification  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   accuracy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The rank based evaluation metrics for entity prediction include&lt;br /&gt;
&lt;br /&gt;
* Mean Reciprocal Rank (MRR) and&lt;br /&gt;
* Hits@K.&lt;br /&gt;
&lt;br /&gt;
Mean reciprocal rank is the average of the reciprocal ranks of the correct entities: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;MRR = \frac{1}{|\mathcal{Q}_c|}\sum_{q \in \mathcal{Q}_c} \frac{1}{R(q)},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{Q}_c&amp;lt;/math&amp;gt; is set of correct entries and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(q)&amp;lt;/math&amp;gt; is the rank of the entry q. Larger the MRR, better the entity prediction and hence also the used KG embedding model.&lt;br /&gt;
&lt;br /&gt;
Hits@k is the proportion of the correct entities in the best k predictions:&amp;lt;br /&amp;gt;&lt;br /&gt;
Hits@k&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;= \frac{|q \in \mathcal{Q}_c|: R(q) &amp;lt; k}{|\mathcal{Q}_c|}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Larger the Hits@k better the entity prediction and hence also the used KG embedding model.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6524</id>
		<title>Graph Theory and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6524"/>
		<updated>2025-03-11T22:19:20Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;graph-theory-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Graph Theory and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on graph theory the reader is referred to the book [Gross and Yellen(1998)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;seven-bridges-of-königsberg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Seven Bridges of Königsberg ==&lt;br /&gt;
&lt;br /&gt;
Seven Bridges of Königsberg is a problem of mathematics formulated by Leonhard Euler after a walk in Königsberg in Prussia (now Kaliningrad, Russia). The islands were connected to each other and the mainlands on the two sides of the Pregel River via seven bridges (see Figure [[#fig:Königsberg_bridges|2]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Königsberg_bridges&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Konigsberg_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The problem is to find a walk path that would cross each of the seven bridges only once.&lt;br /&gt;
&lt;br /&gt;
Leonhard Euler has resolved the problem in 1736 by showing that such a walk path does not exist. His solution founded the graph theory and therefore the Seven Bridges of Königsberg problem is considered to be the first problem of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graphs-theory-basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Graphs theory basics ==&lt;br /&gt;
&lt;br /&gt;
A graph is a mathematical object consisting of vertices (nodes) and edges connecting pairs of vertices, see example in Figure [[#fig:exa_undirected_graph|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_undirected_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_undirected_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Graph theory studies properties of graphs and problems which can be described by means of graphs. Graph theoretical algorithms and results are applied in many areas, like e.g. transport networks, computer science or biology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basics ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Basic terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A graph is composed of vertices (nodes) and edges connecting pairs of vertices. Vertex and edge are the two basic units of the graph. The set of vertices and edges is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{V}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;, respectively. In undirected graph the edges have no direction, they simple connect two vertices. The graph shown in Figure [[#fig:exa_undirected_graph|3]] is an example of an undirected graph.&lt;br /&gt;
&lt;br /&gt;
The degree of a vertex is the number of edges connected to it. A path is an uninterrupted line connecting two vertices over sequence of edges and vertices. For example the path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,5,6)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] connects the vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;. This way a path is specified by an ordered list of all vertices locating on the uninterrupted line going from the starting vertex of the path to the end vertex of it. A cycle is a path, whose start vertex and end vertex is the same. For example &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,3,4,1)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] is a cycle. A graph is called connected graph, if there is a path between any two vertices of the graph. For example the graph in Figure [[#fig:exa_undirected_graph|3]] is a connected graph.&lt;br /&gt;
&lt;br /&gt;
In the weighted graph each edge has a weight (or cost) associated to them. This weight can represent different physical properties, like e.g. distance between two nodes, capacity of a network link, transport cost of a way between two nodes, etc. An example of a weighted graph can be seen in Figure [[#fig:exa_weighted_graph|4]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_weighted_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_weighted_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Types of graphs&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The classification of graphs into various types is based on the properties of the considered subclass of graphs. The most important types of graphs together with their definitions are given as follows.&lt;br /&gt;
&lt;br /&gt;
* Undirected graph - A graph with edges having no direction.&lt;br /&gt;
* Directed graph - A graph with edges having direction.&lt;br /&gt;
* Unweighted graph - A graph with edges having no weights associated to them.&lt;br /&gt;
* Weighted graph - A graph with edges having weights associated to them.&lt;br /&gt;
* Connected graph - A graph having path between any two of its vertices.&lt;br /&gt;
* Disconnected graph - A graph containing at least one pair of vertices having no path between them.&lt;br /&gt;
* Cyclic graph - A graph containing at least one cycle.&lt;br /&gt;
* Acyclic graph - A graph does not containing any cycles.&lt;br /&gt;
* Tree - A connected acyclic graph.&lt;br /&gt;
* Multi-graph - A graph containing at least one pair of vertices having multiple edges between them.&lt;br /&gt;
* Simple graph - A graph without cycles and multiple edges between the same pair of vertices.&lt;br /&gt;
* Complete graph - A graph in which each pair of vertices is connected by edge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Graph descriptions&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most often used graph representations in algorithms are&lt;br /&gt;
&lt;br /&gt;
* adjacency matrix and&lt;br /&gt;
* adjacency list,&lt;br /&gt;
&lt;br /&gt;
because they enable the mathematical description of graphs by means of programming variables, like matrix, array and list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency matrix&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adjacency matrix is suitable to describe unweighted graphs, both undirected and directed ones. Adjacency matrix is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V \times V&amp;lt;/math&amp;gt; matrix, whose &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element describes the existence of the connection from vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; as a binary value. If there is a connection then this value equals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. For example the adjacency matrix of the undirected, unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] looks like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left(&lt;br /&gt;
    \begin{array}{llllll}&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&lt;br /&gt;
    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right).&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The construction of the adjacency matrix implies that the adjacency matrix of an undirected graph is always a symmetric matrix. The idea of describing an unweighted graph by constructing an adjacency matrix as 2-dimensional array can be theoretically extended to describe a weighted graph by constructing a 3-dimensional array, in which the third dimension represents the weight assigned to the edge specified by the first two dimensions. Such a 3-dimensional could be called as adjacency tensor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another way of mathematical representation of a graph is the adjacency list. Adjacency list is an array of lists, in which each list specifies a set of neighbours of a vertex assigned to the actual list as index of the array. In describing a weighted graph, the list consists of the comma separated sequence of &amp;amp;quot;ending vertex: weight&amp;amp;quot; pairs, where each such pair specifies an edge to the given ending vertex with the given weight starting from the vertex to which the considered list belongs to. In case of an unweighted graph the list is a comma separated sequence of neighbour vertexes of the vertex to which the considered list belongs to. Therefore this type of representation is suitable to describe both unweighted and weighted graphs. For example the adjacency list of the unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2,4\} \\&lt;br /&gt;
2: &amp;amp; \{1,3,5\}\\&lt;br /&gt;
3: &amp;amp; \{2,4\} \\&lt;br /&gt;
4: &amp;amp; \{1,3,5\} \\&lt;br /&gt;
5: &amp;amp; \{2,4,6\} \\&lt;br /&gt;
6: &amp;amp; \{5\}&lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly the adjacency list of the weighted graph example in Figure [[#fig:exa_weighted_graph|4]] can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2:5,3:2\} \\&lt;br /&gt;
2: &amp;amp; \{1:5,3:3,4:4\}\\&lt;br /&gt;
3: &amp;amp; \{1:2,2:3,4:1\} \\&lt;br /&gt;
4: &amp;amp; \{2:4,3:1,5:3\} \\&lt;br /&gt;
5: &amp;amp; \{1:8,4:3\} &lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Edge list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Still another way of mathematically describing a graph is to specify it as edge list. Each edge is specified by a sequence in the form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[&amp;lt;/math&amp;gt; starting vertex, ending vertex, weight (optional) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;]&amp;lt;/math&amp;gt;. Thus the edge list can be given as a two/three column matrix for unweighted/weighted graphs. Hence this type of representation is suitable to describe both unweighted and weighted graphs. The unweighted graph in Figure [[#fig:exa_undirected_graph|3]] and the weighted graph in Figure [[#fig:exa_weighted_graph|4]] can be described by edge list, respectively, as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2], [2,3], [1,4], [4,5], [2,5], [3,4], [5,6] ]  \\&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2,5], [2,3,3], [3,1,2], [2,4,4], [4,3,1], [1,5,8], [4,5,3] ]. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graph-problems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Graph problems ===&lt;br /&gt;
&lt;br /&gt;
Graph theory can be applied for solving different problems in many areas. Without claim for completeness we list several well-known graph problems with their brief description.&lt;br /&gt;
&lt;br /&gt;
* Graph coloring - Graph coloring is a group of problems all of them having something to do with coloring of graphs. Usually they are specified by means of a restriction on the way of coloring, like e.g no adjacent vertices may have the same color. One of the famous result in graph coloring is the so called [https://en.wikipedia.org/wiki/Four_color_theorem Four-color theorem]&lt;br /&gt;
* Network flow problems - Network flow problems deal with question related to [https://en.wikipedia.org/wiki/Flow_network Flow networks].&lt;br /&gt;
* Covering problems - Covering problems are set cover problems dealing with covering some subsets of vertices/subgraphs. Vertex cover problem is a special case of set cover problems, in which for every edge its starting or end vertex is in the vertex cover.&lt;br /&gt;
* Route problems - Route problems are graph problems, which are all related to find a route specified by various constraints on the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Route problems&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Route problems form an important class of graph problems, since they have applications in many areas. Here is a list of several selected Route problems, which will be discussed in more details in the rest of this section.&lt;br /&gt;
&lt;br /&gt;
# Hamiltonian path and Eulerian path&lt;br /&gt;
# Traveling salesman problem&lt;br /&gt;
# Chinese postman problem (Route inspection problem)&lt;br /&gt;
# Minimum spanning tree&lt;br /&gt;
# Shortest path problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-vertex-cover-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum Vertex Cover Problem  ==&lt;br /&gt;
&lt;br /&gt;
Vertex cover problem is a kind of set cover problems, in which a set of vertices are searched, which includes at least one endpoint of every edge of the graph. The Minimum Vertex Cover Problem (MIN-VC) is a vertex cover problem on undirected graph, in which a set of minimum number of vertices are searched, which includes at least one endpoint of every edge of the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_minvc&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_minvc.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the minimum vertex cover of the example graph in Figure [[#fig:exa_graph_minvc|5]] is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,4\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,4,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{1,3,5\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The MIN-VC is an optimization problem and it can be reformulated to a decision problem, which is also called as &amp;amp;quot;vertex cover problem&amp;amp;quot;. It is known to be [https://en.wikipedia.org/wiki/NP-completeness NP-complete] (nondeterministic polynomial-time complete), so usually so it cannot be solved by a polynomial-time algorithm.&lt;br /&gt;
&lt;br /&gt;
There is an approximate algorithm for determining the minimum vertex cover of an undirected graph. Its schematic representation is shown in Algorithm 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 1 Approximate algorithm for MIN-VC&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph given by an edge list (= set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;).&amp;lt;br /&amp;gt;&lt;br /&gt;
Output : Found set of vertex cover &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise set of vertex cover: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;=&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; is not empty&amp;lt;br /&amp;gt;&lt;br /&gt;
3   Take an arbitrary edge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(u,v)&amp;lt;/math&amp;gt; from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   Remove all edges from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; having endpoint either &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It can be proven that the above approximate algorithm for MIN-VC always finds a vertex cover whose size is not more than twice of the size of the minimum vertex cover. The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;. The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|&amp;lt;/math&amp;gt; The memory is needed to store the visited vertices, i.e. the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-hamiltonian-path&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Eulerian path and Hamiltonian path ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eulerian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. Note that the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted. However this does not affect the mathematical treatment of Eulerian path, therefore we treat these cases commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for for the existence of Eulerian path in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Either none of the vertices or exactly two vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have odd degree and all its other vertices have even degree.&lt;br /&gt;
&lt;br /&gt;
Along the Euler path, each time walking through a vertex we walking through two previously unseen edges: one at approaching the vertex and the other at leaving it. On this way the number of edges at each middle vertex (i.e. the vertices except the starting and ending vertices of the path) must be even. The starting and ending vertices of the path are enabled to have odd degree, as the start or finish of the walk goes through on only one edge connected to that vertices. This argument proves the necessity of the condition. It turns out that the condition is also sufficient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-path&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-path.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_graph_E-path|6]] has an Euler path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,3,4,5,2,4)&amp;lt;/math&amp;gt;, since only vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree.&lt;br /&gt;
&lt;br /&gt;
An Euler path can be determined by going through the graph starting from a vertex with odd degree and selecting always previously unseen edges at each vertices. The conditions ensure that this always leads to an Euler path. This process requires the logging of the already visited edges at each vertex. It follows that the computational complexity of finding an Euler path is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Seven Bridges of Königsberg is a problem of finding an Euler path. In fact Leonard Euler solved it in 1736 by showing that there is no path that visits every of the seven bridges exactly once. His solution applies the above argument for necessary condition. Euler’s solution of the Königsberg bridge problem is the first theorem of graph theory and laid the foundations of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian cycle in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. Similarly to Eulerian path, the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted, which does not affect of the mathematical treatment of Eulerian cycle. Hence these cases are treated commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. A graph containing a Eulerian cycle is a Eulerian graph.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for the existence of Eulerian cycle in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be formulated as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
This can be argumented similarly as in case of Eulerian path. Because in case of Eulerian cycle the path returns to the starting vertex, no odd degree is allowed yet for that vertex.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_graph_E-path|6]] has no Eulerian cycle, since not every vertices have even degree (vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However the in the graph in Figure [[#fig:exa_graph_E-cycle|7]] every vertices have even degree, therefore it has a Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
Finding a Eulerian cycle can be completed on the same way as described for Eulerian path, but the visit can start at any vertex, since all vertices have even degree. Like in case of finding an Eulerian path, finding a Eulerian cycle has a computational complexity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Hamiltonian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. The path have not to return to the starting vertex, i.e. Hamiltonian path is an open path. Finding a Hamiltonian path is in general an NP-complete problem.&lt;br /&gt;
&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_undirected_graph|3]] has more Hamiltonian paths: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(3,2,1,4,5,6)&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,4,3,2,5,6)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* transportation networks (finding optimal routes),&lt;br /&gt;
* circuit design and&lt;br /&gt;
* graph theory research.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle (or Hamiltonian circuit) in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. A graph containing a Hamiltonian cycle is a Hamiltonian graph, otherwise it is non-Hamiltonian graph. Like in case of finding a Hamiltonian path, finding a Hamiltonian cycle is also an NP-complete problem. Finding a Hamiltonian path is often easier than finding a Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_undirected_graph|3]] has no Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_H_cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_H_cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However a slightly different graph in Figure [[#fig:exa_graph_H_cycle|8]] has a Hamiltonian cycle: (5,2,1,4,3,5).&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* computer science,&lt;br /&gt;
* logistics and&lt;br /&gt;
* network design.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algorithms for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the next we give a brief description of the following two algorithms for finding Hamiltonian cycle:&lt;br /&gt;
&lt;br /&gt;
* Brute-force search and&lt;br /&gt;
* Backtracing algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Brute-force search - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search (also called exhaustive search) follows a naive approach and tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequences of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Backtracing algorithm - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of Backtracing algorithm is to add iteratively a new vertex to the actual path of subsequence of vertices, which is an adjacent to the last vertex of the actual path and not yet included in that path. After having the path with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices, it is checked whether it composes a cycle or not. If not then change the path by trying systematically all the adjacent vertices at every position in the path backwards, which is called backtracking.&lt;br /&gt;
&lt;br /&gt;
The algorithm can be implemented on elegant way by applying a recursive function call. The pseudo code of the algorithm is given in Algorithm 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 2 Backtracing algorithm - for finding Hamiltonian cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if Hamiltonian cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if Hamiltonian cycle exist&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]&amp;lt;/math&amp;gt;= first vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
3 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Recursive function&amp;lt;br /&amp;gt;&lt;br /&gt;
bool try_next_vertex_and_check_cycle(path_index k)&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: next index in the path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if backtracking or cycle not exists&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k == |\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2   if exists edge between last and first vertices of path&amp;lt;br /&amp;gt;&lt;br /&gt;
3     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
4   else&amp;lt;br /&amp;gt;&lt;br /&gt;
5     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v \in \mathcal{V}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is adjacent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k-1]&amp;lt;/math&amp;gt; (=last vertex in path)&amp;lt;br /&amp;gt;&lt;br /&gt;
9    and&amp;lt;br /&amp;gt;&lt;br /&gt;
10  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is not yet in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11    path[k]=v&amp;lt;br /&amp;gt;&lt;br /&gt;
12    if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(k+1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13      return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14    end&amp;lt;br /&amp;gt;&lt;br /&gt;
15    (Backtracking - remove v from path)&amp;lt;br /&amp;gt;&lt;br /&gt;
16    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k] = -1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
17  end&amp;lt;br /&amp;gt;&lt;br /&gt;
18 end&amp;lt;br /&amp;gt;&lt;br /&gt;
19 return false (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the course of backtracking every neighbours of every vertices can be tried by the algorithm. Therefore its computational complexity is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;chinese-postman-problem-route-inspection-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Chinese postman problem (Route inspection problem) ==&lt;br /&gt;
&lt;br /&gt;
The Chinese postman problem (also called as route inspection problem) is an extension of finding Eulerian cycle in connected and (unweighted or weighted) undirected graphs. The Chinese postman problem is to find shortest path that visits every edge of the connected and undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; at least once and return to the starting vertex. So the problem is defined on connected graph. The shortest path is defined as the one with minimum number of edges for unweighted graph and as the path with minimum accumulated weights for weighted graph. The solution path of Chinese postman problem is called Chinese postman tour. The Chinese postman problem can be solved in polynomial time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; contains an Eulerian cycle, then it is also the solution for the Chinese postman problem, since Eulerian cycle has the shortest path (minimum number of edges in unweighted graph and minimum accumulated weights in weighted graph) due to the necessity of visiting all edges at least once.&lt;br /&gt;
&lt;br /&gt;
Therefore the necessary and sufficient condition for the solution for the Chinese postman problem to be the Eulerian cycle is the existence of Eulerian cycle, which can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
For example graph in Figure [[#fig:exa_graph_E-cycle|7]] the solution, i.e the Chinese postman tour is the Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-non-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Non-Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; has no Eulerian cycle, then the graph must be extended to become Eulerian. This is done by duplicating some edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; connected to vertices with odd degree in order to change the degree of all these vertices become to even. The edges to be duplicated must be selected from the relevant ones (i.e. connected to vertices with odd degree) on that way, that the increase of the path length due to edge duplication must be the possible smallest. Therefore those pairing of the vertices with odd degree are selected, which have the shortest path connecting them.&lt;br /&gt;
&lt;br /&gt;
The example unweighted graph in Figure [[#fig:exa_graph_cpp_unweighted|9]] shows a Non-Eulerian graph and the Chinese postman tour obtained by duplicating the edges [2,4] and [3,1].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_unweighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_unweighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Similarly the example Non-Eulerian weighted graph in Figure [[#fig:exa_graph_cpp_weighted|10]] illustrates the construction of the Chinese postman by duplicating the edges [2,4], [4,6] and [5,1]. Here duplicating [2,4] together with [4,6] instead of [2,6] inserts shorter path (i.e. accumulated weight 2+1= 3 instead of 5). Similarly duplicating [5,1] instead of [5,3] together with [3,1] inserts shorter path (i.e. accumulated weight 1 instead of 1+2=3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_weighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_weighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithm-for-chinese-postman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithm for Chinese postman problem ===&lt;br /&gt;
&lt;br /&gt;
Based on the above considerations the algorithm for finding the Chinese postman route can be given schematically by means of its steps in Algorithm 3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 3 Algorithm for Chinese postman problem&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Chinese postman route.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if grap &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is Eulerian&amp;lt;br /&amp;gt;&lt;br /&gt;
2    Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    return Eulerian cycle and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Find all vertices with odd degree and store in array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;oddVertices&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Construct the complete graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt; from odd vertices together with edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt;representing shortest paths among any pairs of odd vertices&amp;lt;br /&amp;gt;&lt;br /&gt;
9    Find minimum weight perfect matching in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt;, i.e the set of edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; reaching every odd vertices and together having smallest sum of weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; This set of edges is called minimum T-join.&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Extend the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; by adding all edges from minimum T-join&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; resulting in extended graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
12   Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14   return Eulerian cycle of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The numerical complexity of the above minimum T-join based algorithm for solving the Chinese postman problem is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, since both setting up the complete graph, and finding minimum weight perfect matching in it takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt; computational steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-spanning-tree---kruskals-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum spanning tree - Kruskal’s algorithm ==&lt;br /&gt;
&lt;br /&gt;
A spanning tree of a graph is a tree including every vertices of the graph. The number of edges of a spanning tree is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt;, since the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt;-th edge would introduce a cycle and it were not any more a tree.&lt;br /&gt;
&lt;br /&gt;
The minimum spanning tree (MST) is defined for a weighted, undirected, connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;, as a spanning tree with the minimal accumulated weights.&lt;br /&gt;
&lt;br /&gt;
Kruskal’s algorithm can be used to determine the MST of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. In the Kruskal’s algorithm all edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; are sorted according to their weights in increasing order. Then the algorithm iteratively adds the next edge from the sorted list, i.e. the edge with the smallest weight, together with their vertexes to MST, if the newly added edge does not induce a cycle. The algorithm proceeds until every edge on the list is checked. On this way the resulted graph will have &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt; edge, so it will be a spanning tree and the way of constructing implies that it will have the least accumulated weights.&lt;br /&gt;
&lt;br /&gt;
The algorithm takes in each step the locally optimal decision due to adding the edge with the smallest weight among the still available ones. Therefore Kruskal’s algorithm is a greedy algorithm.&lt;br /&gt;
&lt;br /&gt;
The algorithm is shown schematically in Algorithm 4.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 4 Kruskal’s algorithm for detrmining MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: MST of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise graph MST to be set empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Sort every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; in increasing weight order and insert them,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; together with their vertexes into array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=0,\ldots size(sortedListEdges)-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    if inserting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST does not induce a cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
5      Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST&amp;lt;br /&amp;gt;&lt;br /&gt;
6    end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt;, since sorting the edges has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; complexity, iterating through every edges and checking cycle has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|) =\mathcal{O}(log(|\mathcal{E}|)&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{E}|&amp;lt;/math&amp;gt; is at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;, which is needed to store edges together with their vertexes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;traveling-salesman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Traveling salesman problem ==&lt;br /&gt;
&lt;br /&gt;
The Traveling Salesman Problem (TSP) originates from a context of cities and given distances among them. TSP is to look for the shortest path that goes through each city exactly once and returns to the starting city. Usually there exists a route between any pair of cities with some given distance. In graph theory context an equivalent formulation of TSP can be given as looking for a path with the least accumulated weights in a weighted, often complete graph, that goes through each vertex exactly once and returns to the starting vertex. This is equivalent with finding the Hamiltonian cycle with the minimum accumulated weight in a weighted, often complete graph. Thus the TSP is more general than Hamilton cycle problem and hence Hamilton cycle problem is a special case of TSP. The resulted path can be also called as TSP path.&lt;br /&gt;
&lt;br /&gt;
The TSP was formulated mathematically in the 19th century and was first studied mathematically in the 1930s. The decision problem version of TSP is an NP-complete problem, so TSP is NP-hard. TSP is one of the most intensively investigated problem in combinatorial optimization, since it is used as benchmark for other optimization methods in terms of computational complexity.&lt;br /&gt;
&lt;br /&gt;
Some properties of TSP can be provided as&lt;br /&gt;
&lt;br /&gt;
* Symmetric and asymmetric TSP. In symmetric TSP the distance between two cities is the same in both direction, which leads to a formulation in graph theory context to a TSP on undirected graph. In asymmetric TSP either do not exist a path between two cities in both direction or the distances are different excluding the higher one from the TSP formulation. In these cases the formulation in graph theory context yileds a TSP on directed graph.&lt;br /&gt;
* Completing the graph by adding edges with sufficiently long distances will not affect the optimal path.&lt;br /&gt;
* The path to be a cycle or an open path does not make difference in the computational complexity of TSP (like in case of Hamilton path problem).&lt;br /&gt;
&lt;br /&gt;
The TSP has applications in numerous fields, like logistics, route planning in transport networks, manufacturing of microchips and DNA sequencing. One-way streets, airfares with different departure and arrival fees are real-world scenarios for applying asymmetric TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;generalizations-of-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Generalizations of TSP ===&lt;br /&gt;
&lt;br /&gt;
Several generalizations of TSP are listed below.&lt;br /&gt;
&lt;br /&gt;
* The travelling politician problem (also called as &amp;amp;quot;generalized travelling salesman problem&amp;amp;quot;) has a context with states having one or more cities and the travelling man must visit exactly one city from each state. It has been shown that travelling politician problem can be led back to standard TSP with modified distance matrix.&lt;br /&gt;
* The travelling purchaser problem has a purchaser, who has to buy a set of products, which can be bought in more cities but at different prices. The optimization objective is to find a path among a subset of cities that enables to buy all the products with minimal total cost (=taveling cost + purchasing cost).&lt;br /&gt;
* Vehicle routing problem.&lt;br /&gt;
* Ring star problem ([Labbé et al.(2004)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;integer-linear-programming-formulation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Integer linear programming formulation ===&lt;br /&gt;
&lt;br /&gt;
In order to form the TSP as Integer Linear Programming (ILP) optimization, several variables must be introduced. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; denote the number of cities (vertices), i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N = |\mathcal{V}|&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_{ij}&amp;lt;/math&amp;gt; stand for the distances (weights) between the cities (vertices) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}&amp;lt;/math&amp;gt; be a decision variable describing whether the path goes from city (vertix) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, or not for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;x_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~path~goes~i \rightarrow j}  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~~~~~~~~~~~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\}.&amp;lt;/math&amp;gt; The integer nature of the values &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; makes this optimization problem an ILP. The objective function of the optimization task is to minimize the path length (= accumulated weights), in other word&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij} ~j = 1, \ldots, N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However without further constraints this optimization considers not only paths, which are characterized by also leaving each reached vertex, but all set of edges enabling the minimum being at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j \in \mathcal{V}&amp;lt;/math&amp;gt;. Therefore further constraints are necessary to ensure that paths are considered and each vertex is visited exactly once. These requirements can be forced by formulating the following further two constraints, which force that the path reaches each vertex exactly once and leaves each vertex exactly once &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N, \\&lt;br /&gt;
\sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constraints ensure that the selected way looks locally as path and all vertices are visited, but still allow that the selected set of edges comprises several local paths each of them visiting only a disjunct subset of vertices instead of one global path visiting every vertices. This global path requirement makes TSP a difficult problem. There are more ways to formulate this global path requirement as a linear constraint. The Miller-Tucker-Zemlin formulation introduces dummy variables &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; for keeping track the order of visit the city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 1, \ldots, N&amp;lt;/math&amp;gt;. The path starts with visiting city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. The global path requirement is ensured by forcing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; being higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; is visited before city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 2, \ldots, N&amp;lt;/math&amp;gt;. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; must be higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; at least by one when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; locates on the path after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, and otherwise by a values less than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; to ensure that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; does not force an unwanted relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt;. Since city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is left out from these constraint, it ensures that the optimal path must return to city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise the value of the dummy variable of the city visited after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N-1&amp;lt;/math&amp;gt; would be less that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_{N-1}&amp;lt;/math&amp;gt;, which would violate the constraint. The city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is the only one for which a decrease in value of the dummy variable allowed when the path reaches city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. These considerations lead to the formulation of the global path requirement as a linear constraint as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting all these together gives the Miller-Tucker-Zemlin ILP formulation of the TSP as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij},~\ldots, N, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~subject~to} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}1.~~~ \sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N,  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}2.~~~ \sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N,  \mathrm{~and~} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\ &lt;br /&gt;
\mathrm{~constraint~}3.~~~ u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithms-for-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithms for TSP ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Exact algorithm - Brute-force search&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices and selects the one with the lowest accumulated weights. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequence of vertices the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;. Hence this approach becomes intractable already for number of cities in the magnitude of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;20&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Approximate algorithms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the NP-completeness of the TSP the exact solution becomes intractable very fast as the number of cities increases. Therefore there is a need for establishing approximate algorithms for the TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Nearest neighbour algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nearest Neighbour (NN) algorithm selects the nearest not yet visited neighbour city at each step. Thus its decision is locally optimal in each step, therefore it is a greedy algorithm. Its schematic representation is shown in Algorithm 5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 5 Nearest neighbour approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Hamiltonian cycle with minimum accumulated weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]=1&amp;lt;/math&amp;gt; and set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array =sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=1,\ldots N-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Select nearest not yet visited city among neighbours of city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v-1]&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v]=u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight += weight(path[v-1], u)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the NN algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|)&amp;lt;/math&amp;gt;. For city arrangement distributed randomly on the plane, the NN algorithms gives a path which is only 25% longer than the shortest one. However for specific city arrangements the NN algorithm can produce also the worst route.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Christofides algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heuristic approach of Christofides is based on using graph theoretical results to compose an approximate algorithm. It utilizes that a TSP path can not be longer than an Eulerian path over all cities of the graph. Therefore first a subgraph including all cities must be found, than it is extended to be an Eulerian graph, afterwards the Eulerian path is determined in the Eulerian graph and finally it is converted to a TSP path (i.e. to visit each city only once). If the minimum spanning tree of the original graph is selected as first graph and it is made to be an Eulerian graph by doubling every edge in it, then the total length of an Eulerian path can not be more than twice the one of the TSP path. Note that the length of the path changes also at converting the Eulerian path to a TSP path. During this step, shortcut is created for each city visited twice by inserting an edge from the city before this to a city after this. On this way one can approximate a solution for the TSP. The steps of the Christofides algorithm are shown schematically in Algorithm 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 6 Christofides approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Duplicate every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; to create an Eulerian graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find an Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Christofides algorithm was one of the first approximation algorithm, which shown that establishing an approximation algorithms can be practically usable approach for solving exactly intractable problems.&lt;br /&gt;
&lt;br /&gt;
An improved version of the algorithm is the algorithm of Christofides and Serdyukov, in whic a better way of creating an Eulerian graph is applied. This is done by applying the so called minimum weight matching. The steps of the algorithm of Christofides and Serdyukov can be seen schematically in Algorithm 7.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 7 Approximate algorithm of Christofides and Serdyukov for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Apply minimum weight matching to odd-degree vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; giving graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find optimal Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Approximate algorithm of Christofides and Serdyukov gives an approximate TSP path with accumulated weights, which is at most 1,5 times higher than the one of the optimal TSP path. The computational complexity of the approximate algorithm of Christofides and Serdyukov is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, which is mainly caused by minimum weight matching algorithm part.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;shortest-path-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Shortest path problem  ==&lt;br /&gt;
&lt;br /&gt;
The shortest path in a weighted graph between two vertices is the path connecting them with the smallest accumulated weight. There are more algorithm for finding shortest path, each with a slightly different applicability scope.&lt;br /&gt;
&lt;br /&gt;
Besides of Diskstra’s algoritm another common algorithms are the [https://en.wikipedia.org/wiki/Bellman-Ford_algorithm Bellman-Ford] and the [https://en.wikipedia.org/wiki/Floyd-Warshall_algorithm Floyd Warshall] algorithms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;dijkstra-algorithmus&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Dijkstra-Algorithmus ===&lt;br /&gt;
&lt;br /&gt;
Diskstra’s algorithm finds the shortest path from a given source vertex to every vertices in a weighted graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. The graph must not contain negative edge, since in that case the algorithm fails.&lt;br /&gt;
&lt;br /&gt;
The idea of Diskstra’s algorithm is an iterative extension of shortest path tree (SPT) containing a subtree with vertices, for which the shortest paths from the a given source have already been found. The vertices outside of SPT have also minimum distance values assigned during the intermediate steps of the processing. The minimum distance values of vertices being neighbour of any vertices of SPT and locating outside of SPT represent the minimum distance from source vertex to the considered vertex via every possible routes over the vertices of the actual SPT. The iterative extension of SPT is performed by selecting the vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with the shortest minimum distance among the vertices locating outside of SPT, adding this vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; together with its minimum distance to SPT and reevaluating the minimum distances of each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; locating outside of the updated SPT and being the neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;. During the reevaluation the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is compared to the sum (minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)) and if the later is smaller then the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; will be updated.&lt;br /&gt;
&lt;br /&gt;
The schematical representation of the algorithm can be seen in Algorithm 8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 8 Dijkstra-Algorithmus for determining SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
- Source vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Array of minimum distances to every vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Create an adjacenty matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; for maintaining SPT with vertices (subtree),&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;for which the shortest paths from the a given source have already been found&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and initialize it to empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; stores already found minimum distance values for its vertices.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Create and adjacency matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; for representing the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being a&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;subgraph of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; containing vertices locating outside of SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and every edges of them. Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; stores also actual values of&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;minimum distance to every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Initialize all these distance values to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt;, and for the source vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;set the minimum distance to the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is not empty (=not all vertices are moved from it)&amp;lt;br /&amp;gt;&lt;br /&gt;
4    take a vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with the smallest minimum distance&amp;lt;br /&amp;gt;&lt;br /&gt;
5    add vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with its minimum distance and its edge connecting it to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
6     matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7      for each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8        (update minimum distance of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; in matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: )&amp;lt;br /&amp;gt;&lt;br /&gt;
9        if minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;) &amp;amp;lt; minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
10         minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; = minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
11         mark edge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; as edge connecting to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
12       end&amp;lt;br /&amp;gt;&lt;br /&gt;
13     end&amp;lt;br /&amp;gt;&lt;br /&gt;
14     remove the row of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15      (that means also removing vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
16 end&amp;lt;br /&amp;gt;&lt;br /&gt;
17 Build up array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt; from SPT matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
18 return array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt;, since finding the vertex in the subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))&amp;lt;/math&amp;gt; operations, which must be done for every vertices. Note that it is the same as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))= \mathcal{O}(log(|\mathcal{E}|))&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The finding the vertex of subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; with the smallest minimum distance can be implemented by the help of priority queue (or Heap). The standard usage of priority queue would overwrite minimum distance in the inserted pair (minimum distance - vertex) for the same vertex always by the minimum distance of the lastly checked edge to that vertex, which is not necessarily the smallest one among every edges. This can be resolved by inserting more copies of the pair (minimum distance - vertex) for the same vertex, since priority queue will take only the one of them with the smallest value of minimum distance.&lt;br /&gt;
&lt;br /&gt;
Dijkstra’s algorithm assumes that in each intermediate step, the minimum distances of the vertices in SPT, are already the final ones, i.e. the shortest paths from the a given source to the vertices of SPT have already been found. This holds with non- negative weight, since in this case a new path to a vertex in SPT via any vertices of outside of SPT would increase the distance by a sum of non-negative weights which then can not be smaller then the distance marked in SPT as the minimum one. However this is not true in case of existence of negative weight, and thus for graphs with negative weights Dijkstra’s algorithm can return higher distance than than the real minimal one, i.e. wrong result. This is illustrated on the graph in Figure [[#fig:exa_graph_neg_weight|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_neg_weight&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_neg_weight]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For this graph Dijkstra’s algorithm would give minimum distance for node &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;, which is wrong, since the right value is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;5&amp;lt;/math&amp;gt;, respectively&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6521</id>
		<title>Metrics in Data Science</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Metrics_in_Data_Science&amp;diff=6521"/>
		<updated>2025-03-04T23:09:23Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;metrics-in-data-science&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Metrics in Data Science  =  &amp;lt;span id=&amp;quot;evaluation-metrics-for-classification&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Evaluation metrics for classification ==  A classification model is evaluated on the test data. The common metrics used to evaluate the model are listed as  * Accuracy, * Confusion matrix, * Precision and Recall, * Sensitivity and Specificity, * F1Score and weighted F1, * ROC curve and AUC ROC.  Accuracy is the ratio of corr…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;metrics-in-data-science&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Metrics in Data Science  =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-classification&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for classification ==&lt;br /&gt;
&lt;br /&gt;
A classification model is evaluated on the test data. The common metrics used to evaluate the model are listed as&lt;br /&gt;
&lt;br /&gt;
* Accuracy,&lt;br /&gt;
* Confusion matrix,&lt;br /&gt;
* Precision and Recall,&lt;br /&gt;
* Sensitivity and Specificity,&lt;br /&gt;
* F1Score and weighted F1,&lt;br /&gt;
* ROC curve and AUC ROC.&lt;br /&gt;
&lt;br /&gt;
Accuracy is the ratio of correctly classified examples to the total number of examples in the test set. Defining true examples (TE) and false examples (FE) the number of correctly and incorrectly classified examples in the test set, accuracy can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TE}{TE+FE}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The confusion matrix is a metric to visualize the classification performance. The rows of the matrix represent the true classes and the columns shows the predicted classes or vice versa. Both versions are used and can be found in the literature. Here we use the first version. The element (i,j) of the matrix shows the number of test examples belonging to class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and classified as class &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;. Thus besides showing the number of correctly classified examples for each class, the confusion matrix gives an idea of typical missclassifications the model makes. An example confusion matrix can be seen in Figure [[#fig:exa_conf_matrix|16]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_conf_matrix&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/EvalMetric_ConfMatrExa.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 were originally introduced for binary classification models, but their usage can be extended to multiclass case. Therefore they will be defined and explained first for binary classification model.&lt;br /&gt;
&lt;br /&gt;
In terms of binary classification with positive and negative classes, the outcome of the classification task can fall in one of four cases: correctly/incorrectly classified examples belonging to positive/negative class. The prediction is true positive (TP) when a positive example is correctly classified, like e.g. presence of a disease. A false negative (FN) prediction occurs when a positive example is classified by the model as would belong to negative class. Similarly a true negative (TN) prediction occurs when a negative example is correctly classified. Finally the prediction is false positive (FP) when a negative example is classified as would belong to positive class. These cases are summarized in Table [[#tab:poss_predictions|8]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:poss_predictions&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Possible cases of the outcome of the classification task (=prediction)&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| predicted &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\backslash&amp;lt;/math&amp;gt; true  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   positive  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| positive  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true positive (TP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false positive (FP)&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| negative  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false negative (FN)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true negative (TN)&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For the case of binary classification the definition of Accuracy can be given alternatively as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TP+TN}{TP+TN+FP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The terms TP, FN, TN and FP are also used to denote the number of corresponding cases, e.g. TP also denotes the number of true positives.&lt;br /&gt;
&lt;br /&gt;
Precision is the ratio of the correctly classified positive examples to the total number of examples classified as positive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Precision} = \frac{TP}{TP+FP}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In contrast to that Recall is the ratio of the correctly classified positive examples to the total number of positive examples: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Recall} = \frac{TP}{TP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The measures sensitivity and specificity are also commonly used, especially in the healthcare.&lt;br /&gt;
&lt;br /&gt;
Sensitivity is the True Positive Rate (TPR), i.e. the proportion of captured trues and hence it equals to recall. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Sensitivity} = \mathrm{TPR} = \frac{TP}{TP+FN}  = \mathrm{Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specificity is the proportion of the captured negatives, i.e. True Negative Rate (TNR). &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Specificity} = \frac{TN}{TN+FP}.&amp;lt;/math&amp;gt; It follows that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt; is the False Positive Rate (FPR), i.e. proportion of not captured negatives, which is needed to define the ROC curve (see below).&lt;br /&gt;
&lt;br /&gt;
The F1Score is a harmonic mean of precision and recall and therefore it is a number between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{F1Score} =  F_1  = 2*\frac{Precision*Recall}{Precision+Recall}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:use_metrics&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ The usage of the different metrics.&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Metric  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   When to use ?  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Accuracy  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   In case of classification problem&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with balanced classes.  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Precision  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to be sure about the&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   positive prediction to avoid any negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   consequences, like e.g in case of decrease&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   of credit limit to avoid customer dissatisfaction.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Recall  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When it is important to capture positive even&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   with low probability, like e.g. to predict&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   whether a person has illness or not.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Sensitivity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TPR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured positives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Specificity  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   If the question of interest is TNR,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   i.e. the proportion of the captured negatives.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| F1Score  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When both Precision and Recall are important.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| weighted F1 metric  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   When importance of Precision and Recall&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   against each other can be characterized&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   by weights explicitly .&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| ROC curve  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used for determining probability threshold&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   for deciding the output class of the task,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   see Figure x.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| AUC ROC  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   It is used to determine how well the positive class&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   is separated from the negative class.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The weighted F1 metric is a refined version of F1Score, in which Precision and Recall can have different weights. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{ weighted F1} = F_{\beta} = (1+ \beta^2)*\frac{Precision*Recall}{\beta^2 *Precision+Recall},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where Recall has weight &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta^2&amp;lt;/math&amp;gt; is the weight of Precision.&lt;br /&gt;
&lt;br /&gt;
In a multi-class setting the metrics precision and recall, sensitivity and specificity as well as F1Score and weighted F1 metric are calculated first for each class individually and then averaged. This way they quantify the overall classification performance.&lt;br /&gt;
&lt;br /&gt;
The metrics ROC curve and AUC ROC are defined for binary classification task. The Receiver Operating Characteristic (ROC) curve is the True Positive Rate (=Sensitivity) as a function of the False Positive Rate (= &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-Specificity&amp;lt;/math&amp;gt;). The Area Under Curve ROC is called AUC ROC. It indicates how well the positive class is separated from the negative class.&lt;br /&gt;
&lt;br /&gt;
The usage of the different metrics are summarized in the Table [[#tab:use_metrics|9]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:ill_ROC_curve&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/ROC_curve.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Depending on the use case strict, optimal or lenient (= moderate or high) probability threshold can be selected on the ROC curve. This is illustrated in Figure [[#fig:ill_ROC_curve|17]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-regression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metrics for regression ==&lt;br /&gt;
&lt;br /&gt;
The common metrics used for evaluating regression models are are listed here.&lt;br /&gt;
&lt;br /&gt;
* Mean Squared Error (MSE),&lt;br /&gt;
* Root Mean Squared Error (RMSE)&lt;br /&gt;
* Mean Absolute Error (MAE),&lt;br /&gt;
* Mean Absolute Percentage Error (MAPE),&lt;br /&gt;
* Coefficient of Determination (COD), R-squared (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt;),&lt;br /&gt;
* modified R-squared,&lt;br /&gt;
&lt;br /&gt;
The Mean Squared Error (MSE) is one of the basic statistic used to evaluate the quality of a regression model. It is the average of the squares of the difference between the real and predicted values, in other words:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MSE} = \frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2.&amp;lt;/math&amp;gt; Less the MSE, better the regression model fits the real values.&lt;br /&gt;
&lt;br /&gt;
A similar measure is the Root Mean Squared Error (RMSE), which is the square root of MSE and thus it is biven as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{RMSE} = \sqrt{\frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2}.&amp;lt;/math&amp;gt; RMSE is a measure in the same units as the considered variable, which makes it a commonly used measure.&lt;br /&gt;
&lt;br /&gt;
The Mean Absolute Error (MAE) is the average absolute difference between the real and predicted values. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAE} = \frac{1}{K}\sum_{k}|y_k - \hat{y}_k|&amp;lt;/math&amp;gt; A nice property of MAE, that it is less likely influenced by extreme values. It is a common measure used in time series analysis as forecast error.&lt;br /&gt;
&lt;br /&gt;
The mean absolute percentage error (MAPE) quantifies the average of the ratio of the average absolute difference between the real and predicted values to the real value as a percentage. Hence the formula of MAPE can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAPE} = 100 \frac{1}{K}\sum_{k}|\frac{y_k - \hat{y}_k}{y_k}|&amp;lt;/math&amp;gt; MAPE is is commonly used for evaluating regression models and it is an appropriate metric where the scale of the considered value varies in a broad range. Intuitively it can be interpreted as a kind of relative error. This makes it also suitable to be used as a loss function as an objective in the optimization in regression problems.&lt;br /&gt;
&lt;br /&gt;
The metric Coefficient of Determination (COD) is also referred as R-squared and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r^2&amp;lt;/math&amp;gt; and pronounced as &amp;amp;quot;R-squared&amp;amp;quot;. The coefficient of determination determines the predictable proportion of the variation in the dependent variable, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{y}&amp;lt;/math&amp;gt; denote the mean of the output values, in other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{y} = \frac{1}{K} \sum_{k} y_k).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coefficient of determination is defined in terms of residual sum of squares, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{res}}&amp;lt;/math&amp;gt; and total sum of squares (related to the variance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt;), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;SS_{\mathrm{tot}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    SS_{\mathrm{res}} &amp;amp;= \sum_{k} ( y_k - \hat{y}_k)^2, \\&lt;br /&gt;
    SS_{\mathrm{tot}} &amp;amp;= \sum_{k} ( y_k - \bar{y}_k)^2&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}.&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; as metric quantifies the predictable proportion of the variation in the dependent variable. Its value falls between 0 and 1 with greater values indicating better regression fit.&lt;br /&gt;
&lt;br /&gt;
The metric modified (or adjusted) R-squared is introduced to compensate that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R^2&amp;lt;/math&amp;gt; increases when the dimension &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; becomes higher. Denoting the dimension of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{bf y}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;, the modified R-squared, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\bar{R}^2&amp;lt;/math&amp;gt; is defined as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\bar{R}^2 = 1 -\frac{SS_{\mathrm{res}}}{SS_{\mathrm{tot}}}\frac{K-1}{K-N-1} = 1 -(1-R^2)\frac{K-1}{K-N-1}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluation metricS for KG ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;quality-of-kg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Quality of KG ===&lt;br /&gt;
&lt;br /&gt;
The two most important quality measures of a KG are&lt;br /&gt;
&lt;br /&gt;
* completeness and&lt;br /&gt;
* accuracy.&lt;br /&gt;
&lt;br /&gt;
The completeness refers to evaluate the amount of existing triplets in the KG, while accuracy targets to measure the amounts of correct and incorrect triplets in the KG. After KG completion the resulted extraction graph is considered to be not yet a ready KG. Therefore quality measurement of KG is relevant only after KG refinement.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-kg-refinement&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for KG refinement ===&lt;br /&gt;
&lt;br /&gt;
Usually completeness is measured in recall, precision and F-measure.&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, i.e. the amounts of correct and incorrect triplets is evaluated in terms of accuracy and alternatively, or in addition by means of AUC (i.e. the area under the ROC curve).&lt;br /&gt;
&lt;br /&gt;
The accuracy of the KG, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; can be also based on the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt;, which can be assigned by human e.g. based on random sampling. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu(\mathcal{G})&amp;lt;/math&amp;gt; is given by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mu(\mathcal{G}) = \frac{1}{|\mathcal{T}|} \sum_{t \in \mathcal{T}} \mathbbm{1}_{\{t\}},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbbm{1}_{\{t\}}&amp;lt;/math&amp;gt; is the indicator variable indicating the correctness of the individual triplets &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in \mathcal{T}&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; otherwise taking the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In case of human judging, the usual evaluation metric is accuracy or precision together with the total number of judged triplets and errors found.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metric-for-link-prediction-with-kg-embeddings&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metric for link prediction with KG embeddings ===&lt;br /&gt;
&lt;br /&gt;
The used evaluation metric for link prediction with KG embeddings depends on the subtask of link prediction, see in Table [[#tab:Eval_metr_subt_LP|10]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:Eval_metr_subt_LP&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Evaluation metric for subtasks of link prediction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Subtask&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;Evaluation metrics&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   rank based measures&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Entity type prediction  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   Macro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt; and Micro-&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;F_1&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Triple classification  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   accuracy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The rank based evaluation metrics for entity prediction include&lt;br /&gt;
&lt;br /&gt;
* Mean Reciprocal Rank (MRR) and&lt;br /&gt;
* Hits@K.&lt;br /&gt;
&lt;br /&gt;
Mean reciprocal rank is the average of the reciprocal ranks of the correct entities: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;MRR = \frac{1}{|\mathcal{Q}_c|}\sum_{q \in \mathcal{Q}_c} \frac{1}{R(q)},&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{Q}_c&amp;lt;/math&amp;gt; is set of correct entries and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(q)&amp;lt;/math&amp;gt; is the rank of the entry q. Larger the MRR, better the entity prediction and hence also the used KG embedding model.&lt;br /&gt;
&lt;br /&gt;
Hits@k is the proportion of the correct entities in the best k predictions: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Hits@k = \frac{|q \in \mathcal{Q}_c|: R(q) &amp;lt; k}{|\mathcal{Q}_c|}.&amp;lt;/math&amp;gt; Larger the Hits@k better the entity prediction and hence also the used KG embedding model.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6520</id>
		<title>Logic</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Logic&amp;diff=6520"/>
		<updated>2025-03-04T23:06:47Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Logic =  &amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Mathematical logic ==  Mathematical logic is the study of logic in mathematics.  &amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; === Propositional logic ===  Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Logic =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;mathematical-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Mathematical logic ==&lt;br /&gt;
&lt;br /&gt;
Mathematical logic is the study of logic in mathematics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;propositional-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Propositional logic ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with logical statements, which are directly decidable. For example the logical statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2 &amp;lt; 4&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The mathematical logical operators are listed as&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Conjunction&lt;br /&gt;
* Disjunction&lt;br /&gt;
* Implication&lt;br /&gt;
* Double implication&lt;br /&gt;
&lt;br /&gt;
The logical operators are also called as logical connectives.&lt;br /&gt;
&lt;br /&gt;
Negation as logical operator has only one argument, i.e. it concerns only one statement. Negation of a statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if the statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Negation is also called as NOT operator and it is denoted in mathematical logic as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;. For example if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; stands for a statement then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; whenever &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; and vice versa.&lt;br /&gt;
&lt;br /&gt;
Th conjunction and disjunction as logical operators have two arguments. Conjunction is also known as AND operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;. Disjunction is also known as OR operator and denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Implication as logical operator has two arguments. It is also known as conditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt;. Implication (e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; if truth of first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) implies truth of second argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;) or the first argument (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;) is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Double implication as logical operator has two arguments. It is also known as biconditional operator and it is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; either if both &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or if both are &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; is to be read as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; iff &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Truth tables&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators can be also given by their truth tables specifying the logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) of the operator for each possible combinations of the logical values of the arguments of the operator.&lt;br /&gt;
&lt;br /&gt;
The truth table of logical negation is given by Table [[#tab:log_neg|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_neg&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical negation&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg A&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth tables for logical conjunction (and) and for logical disjunction (or) are given below by Tables [[#tab:log_and|[tab:log_and]]] and [[#tab:log_or|5]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \land B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_or&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical disjunction&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \lor B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The truth table for logical implication and logical double implication is shown in Table [[#tab:log_impl|[tab:log_impl]]] and [[#tab:log_doub_impl|7]], respectively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \implies B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:log_doub_impl&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Logical double implication&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt; &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A \iff B&amp;lt;/math&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   False  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   True  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Logic formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators satisfy several laws, which can be formulated as logic formula. They can be proven either directly based on the interpretations of the arising logical operators or by using the truth tables of the arising logical operators.&lt;br /&gt;
&lt;br /&gt;
Below is a list of the fundamental logic formulas. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\equiv&amp;lt;/math&amp;gt; stands for the equivalence relation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Identity laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     &amp;amp;(A \land True) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
     &amp;amp;(A \lor False) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Domination laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land False ) \equiv False \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor True) \equiv True&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Idempotent laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land A) \equiv A \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor A) \equiv A&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Commutative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \equiv (B \land A) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \equiv (B \lor A)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Associative laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;(A \land B) \land C \equiv A \land (B \land C) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;(A \lor B) \lor C \equiv A \lor (B \lor C)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (A \land B) \equiv \neg A \lor \neg B \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (A \lor B) \equiv \neg A \land \neg B&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Absorption laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land (A \lor B) \equiv A  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor (A \land B)  \equiv A &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;A \land \neg A \equiv False  \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;A \lor \neg A  \equiv True &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 1&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt;: The USA is a democratic country. The negation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P =  \neg P&amp;lt;/math&amp;gt;: The USA is not a democratic country.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example 2&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt;: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3 \implies x - 4 &amp;gt; -2&amp;lt;/math&amp;gt;. Is the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; ?&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;gt; 3&amp;lt;/math&amp;gt; then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x-4 &amp;gt; -2&amp;lt;/math&amp;gt; is also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;. So the statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;predicate-logic-in-mathematics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Predicate logic in mathematics ===&lt;br /&gt;
&lt;br /&gt;
Propositional logic deals with statements, whose logical value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt; is directly decidable. More interesting are the statements, whose logical value depends on variables. Predicate logic deals with logical statements over a set of variables.&lt;br /&gt;
&lt;br /&gt;
The elements of predicate logic are given as&lt;br /&gt;
&lt;br /&gt;
* Predicate&lt;br /&gt;
* Variable domain&lt;br /&gt;
* Quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Predicate&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A predicate is a logical statement whose logical value (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;) depends on one or more variables. Thus formally a predicate is a function with codomain &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{True,False\}&amp;lt;/math&amp;gt; and with any set as domain. For predicates tipically a function like notation is used with uppercase letter, like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is the variable it depends on. The predicate is defined by giving a statement involving the variables. For example the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be defined as &amp;amp;quot;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; is the statement: x can be divided by 3&amp;amp;quot;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(9)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt; while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(8)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;. Just like functions, predicates can also depend on more variables. For example for the predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(x,y)&amp;lt;/math&amp;gt; &amp;amp;quot;defined as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y = x^3+1&amp;lt;/math&amp;gt;&amp;amp;quot; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(3,28)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3^3+1 = 28&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Variable domain&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of involving variables, the definition of a predicate, just like in case of functions, must involve also the domains of the involved variables. So the definition of predicate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(x)&amp;lt;/math&amp;gt; can be completed as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;P(x): x \mathrm{~can~be~divided~by~} 3, \mathrm{~where~} x \in \mathbb{N}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quantifier&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often rather a kind of aggregation of the predicate’s truth values is interesting, instead of the concrete logical value of a predicate for a specific value. For example &amp;amp;quot;every negative real number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; satisfies the inequality &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x^3-3x^2+3x-1 &amp;lt; 0&amp;lt;/math&amp;gt;&amp;amp;quot; is not a statement for one specific value of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;, but rather about all possible values of negative &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt;-s.&lt;br /&gt;
&lt;br /&gt;
Such aggregations of the predicate’s truth values are represented by the quantifier of a variable. Thus the quantifier modifies the statement of the predicate by specifying the way of interpretation of the variable, to which the quantifier refers to. The two types of quantifiers are called as&lt;br /&gt;
&lt;br /&gt;
* Existential quantifier,&lt;br /&gt;
* Universal quantifier&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Existential quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The existential quantifier specifies the interpretation of the variable by the concept &amp;amp;quot;there exist an element in the domain of the variable which fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;there exists an integer number x which is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 = -1&amp;lt;/math&amp;gt; holds that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_0 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big OR, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \lor (-2 &amp;lt; 0) \lor (-1 &amp;lt; 0) \lor (0 &amp;lt; 0) \lor (1 &amp;lt; 0) \lor (2 &amp;lt; 0) \lor \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function any() which realizes the existential quantifier. For example &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
  &amp;amp;\mathrm{any}([s[0] == \mathrm{&amp;#039;F&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, due to the string ’Friday’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Universal quantifier&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The universal quantifier represents the concept &amp;amp;quot;every element in the domain of the variable fulfils the given predicate&amp;amp;quot;. The existential quantifier is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; The statement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; is to be interpreted as &amp;amp;quot;every integer number x is less than zero&amp;amp;quot; . This statement is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;False&amp;lt;/math&amp;gt;, since for example for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 = 1&amp;lt;/math&amp;gt; does not hold that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_1 &amp;lt; 0&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The formalism &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \in  \mathbb{Z}, x &amp;lt; 0&amp;lt;/math&amp;gt; can be also interpreted as an abbreviation for a big AND, which runs over every possible values for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; in the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; and tests &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x &amp;lt; 0&amp;lt;/math&amp;gt;, in other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\ldots \land (-2 &amp;lt; 0) \land (-1 &amp;lt; 0) \land (0 &amp;lt; 0) \land (1 &amp;lt; 0) \land (2 &amp;lt; 0) \land \ldots&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Python there is an in-built function also for all() which realizes the universal quantifier. For example, for the previously defined list of strings one can test &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s[3]&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{strs~}=[\mathrm{&amp;#039;Monday}, \mathrm{&amp;#039;Friday&amp;#039;}, \mathrm{&amp;#039;Sunday&amp;#039;}] \\&lt;br /&gt;
&amp;amp;\mathrm{any}([s[3] == \mathrm{&amp;#039;d&amp;#039;~for~}s\mathrm{~in~strs}])&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; would return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;True&amp;lt;/math&amp;gt;, since the fourth letter of all the three strings in the list is ’d’.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula and sentence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The general formula in the predicate logic is built up from the following elements&lt;br /&gt;
&lt;br /&gt;
* predicates (including the domains of the involved variables)&lt;br /&gt;
* propositional operators &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\land&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lor&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\iff&amp;lt;/math&amp;gt;&lt;br /&gt;
* the existential and universal quantifiers&lt;br /&gt;
&lt;br /&gt;
A variable is quantified if there is a quantifier referring to it. A sentence is a special case of formula, in which all variables are quantified. The quantified and unquantified variables are also referred as bound and free variables, respectively.&lt;br /&gt;
&lt;br /&gt;
For example the formula &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt; is not a sentence, since the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; is not quantified. After quantifying also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; we get the sentence &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, x^4 &amp;lt; y&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Valid places for comma for arising in predicate formulas are given as&lt;br /&gt;
&lt;br /&gt;
* separating variables in the same quantification,&lt;br /&gt;
* immediatly after the quantification and&lt;br /&gt;
* seperating arguments in predicate function.&lt;br /&gt;
&lt;br /&gt;
An example for a predicate formula built up from all the three types of elements is given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\forall x,y \in  \mathbb{N}, \exists z \in \mathbb{Z} , P(x,y) \implies R(x,y,z)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Simplification rules&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;simpl_rules&amp;quot; label=&amp;quot;simpl_rules&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking a negation of a statement is very common in practice. However usually it is not easy to interpret and understand negation of formulas. In this case simplification rules can be applied in order to push the negation to right. Below is a list of useful simplification rules with negation.&lt;br /&gt;
&lt;br /&gt;
* Double negation law &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\neg P) \equiv P \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* De Morgan laws &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \land Q) \equiv \neg P \lor \neg Q \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \lor Q) \equiv \neg P \land \neg Q&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\implies&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;iff&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (P \implies Q) \equiv P \land  (\neg Q) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (P \iff Q) \equiv (P \land  (\neg Q)) \lor ((\neg P) \land  Q)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Negation rules for quantifiers &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\neg (\exists x \in \mathbb{S}, P(x))  \equiv \forall x \in \mathbb{S}, \neg P(x) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\neg (\forall x \in \mathbb{S}, P(x))  \equiv \exists x \in \mathbb{S}, \neg P(x)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== First-order logic ==&lt;br /&gt;
&lt;br /&gt;
First-order logic, also called predicate logic, is used not only in mathematics, but also in philosophy, linguistics and computer science. First-order logic allows sentences containing quantified variables. In first-order logic sentences are formulated by means of predicate, like e.g. &amp;amp;quot;For every x, if x has a son, then x is parent&amp;amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;description-of-first-order-formulas&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Description of first-order formulas ===&lt;br /&gt;
&lt;br /&gt;
In this subsection we give a brief overview on the description of the first-order logic. The description of first-order logic requires the introduction of infinite sets like terms and formulas, which are defined inductively.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Elements of first-order logic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements of first-order formulas are given as&lt;br /&gt;
&lt;br /&gt;
* Variables, like x,y, representing any objects, i.e. whose meaning is determined by the semantic.&lt;br /&gt;
* Functions, where function with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary functions.&lt;br /&gt;
* Predicates, where predicates with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; arguments are called &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;-ary predicates.&lt;br /&gt;
* Equality&lt;br /&gt;
* Logical operators or logical connectives&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of terms is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; Variables. Any variable symbol itself is a term.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; Functions. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; is a n-ary function and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is also a term.&lt;br /&gt;
&lt;br /&gt;
Terms are only the expressions, which can be obtained by finite many application of rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf T2.}&amp;lt;/math&amp;gt; are terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The infinite set of formulas is defined by applying the following rules&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; Predicate. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; is a n-ary predicate and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1,\ldots, t_n&amp;lt;/math&amp;gt; are terms then applying &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P()&amp;lt;/math&amp;gt; to these terms, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P(t_1,\ldots, t_n)&amp;lt;/math&amp;gt; is a formula&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; Equality. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; are terms then the equality symbol applied to them, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1=t_2&amp;lt;/math&amp;gt; is a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F3.}&amp;lt;/math&amp;gt; Negation. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\neg \Psi&amp;lt;/math&amp;gt; is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F4.}&amp;lt;/math&amp;gt; Binary logical operators. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi&amp;lt;/math&amp;gt; are formulas then any binary logical functions of them (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \land \Phi&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi \implies \Phi&amp;lt;/math&amp;gt;, etc. ) is also a formula.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt; Quantifiers. If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi&amp;lt;/math&amp;gt; is a formula and x is a variable then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\forall x \Psi&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\exists x \Psi&amp;lt;/math&amp;gt; are also formulas.&lt;br /&gt;
&lt;br /&gt;
The expressions obtained by finite many applications of only rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F2.}&amp;lt;/math&amp;gt; are called atomic formulas. Formulas are only the expressions, which can be obtained by finite many applications of the rules &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F1.}&amp;lt;/math&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F5.}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Precedence of the logical operators&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Precedence of the logical operators enables to interpret a formula without placing any parentheses into it. The precedence of the logical operators in decreasing order is given by&lt;br /&gt;
&lt;br /&gt;
* Negation&lt;br /&gt;
* Disjunction and conjunction&lt;br /&gt;
* Quantifiers&lt;br /&gt;
* Implication&lt;br /&gt;
&lt;br /&gt;
Nevertheless extra parentheses can be inserted into formulas.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;formal-description-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Formal description of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
Description of first-order logic as language is completely formal. The terms and formulas are strings of symbols, the symbols together forms the alphabet of the language.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Alphabet&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The alphabet of symbols can be divided into the following two groups:&lt;br /&gt;
&lt;br /&gt;
* Logical symbols&lt;br /&gt;
* Non-logical symbols&lt;br /&gt;
&lt;br /&gt;
The logical symbols include the infinite set of variables, the logical operators, the quantifier symbols, parenthesis, brackets and other punctuation sybols as well as the equality symbol.&lt;br /&gt;
&lt;br /&gt;
The non-logical symbols include the infinite set of n-ary predicate symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P^2_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for binary predicate symbols) and the infinite set of n-ary function symbols (like e.g. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^3_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; for ternary function symbols)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Language of syntactically valid first-order formulas&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the alphabet, the inductive definition of terms, atomic formulas and formulas the language of syntactically valid first-order formulas can be defined as a cntext-free grammar. This can be seen in Backus-Naur form in Figure [[#fig:Lang_folf_cfg_BNF|15]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Lang_folf_cfg_BNF&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Language_first_order_logic_BNF_grammar.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;semantics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Semantics ===&lt;br /&gt;
&lt;br /&gt;
Semantic meaning of a first-order language is determined by its interpretation. This interpretation - assigns a way of interpretation to each non-logical symbol in that language and - determines the domains of variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;deductive-systems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Deductive systems ===&lt;br /&gt;
&lt;br /&gt;
Deductive system is to show on syntactic level, that one formula logically follows from another formula.&lt;br /&gt;
&lt;br /&gt;
The deductive system is sound if every formula which can be derived in the system is logically valid. On the other hand a deductive system is complete if every logically valid formula can be derived in it.&lt;br /&gt;
&lt;br /&gt;
An important property of the deductive systems that they are completely syntactic, so no any interpretation is utilized for the derivations in such system. This means that if the deductive system is sound, than it holds in every possible interpretation of the language describing the system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Rule of inference&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule of inference represents the concept that from a given formula (set of formulas) another formula (set of formulas) can be derived as a conclusion.&lt;br /&gt;
&lt;br /&gt;
One commonly used rule of inference is the rule of substitution. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; be a term and a formula containing the variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; respectively. Then replacing all free instances of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in the formula &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;. The rule of substitutions states that for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi(x)&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; it can be concluded that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Psi[t/x]&amp;lt;/math&amp;gt;, given the condition that no free variable of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; becomes bound during the substitution process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Formula identities&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Besides of the simplification rules provided in [[#simpl_rules|[simpl_rules]]] several further useful formula identities are listed below.&lt;br /&gt;
&lt;br /&gt;
* Commutativity of the same quantifier &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x \forall y P(x,y) \equiv \forall y  \forall x P(x,y) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x \exists y P(x,y) \equiv \exists y \exists x P(x,y)&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - distributivity &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\forall x P(x) \land  \forall x Q(x) \equiv \forall x (P(x) \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
    &amp;amp;\exists x P(x) \lor  \exists x Q(x) \equiv \exists x (P(x) \lor Q(x))&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
* Quantifier with disjunction and conjunction - exchangeability &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;P \land  \exists x Q(x) \equiv \exists x (P \land Q(x)) \mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\ %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &amp;amp;P \lor \forall x Q(x) \equiv \forall x (P \lor Q(x)) %\mathrm{~~where~}x\mathrm{~must~not ~occur~free~in}P&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;applications-of-first-order-logic&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Applications of first-order logic ===&lt;br /&gt;
&lt;br /&gt;
First-order logic has applications in different scientific fields. Some of them are given below.&lt;br /&gt;
&lt;br /&gt;
* In mathematics it is used for formalizing and provides proof techniques for mathematical theorems.&lt;br /&gt;
* In computer science it is used for logical reasoning and verifying computer programs.&lt;br /&gt;
* In linguistic it is used for formalizing simple quantifier construction in natural language, which serves a basis for knowledge representation languages.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6519</id>
		<title>Graph Theory and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6519"/>
		<updated>2025-03-04T23:04:20Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;,&amp;lt;span id=&amp;quot;graph-theory-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Graph Theory and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on graph theory the reader is referred to the book [Gross and Yellen(1998)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;seven-bridges-of-königsberg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Seven Bridges of Königsberg ==&lt;br /&gt;
&lt;br /&gt;
Seven Bridges of Königsberg is a problem of mathematics formulated by Leonhard Euler after a walk in Königsberg in Prussia (now Kaliningrad, Russia). The islands were connected to each other and the mainlands on the two sides of the Pregel River via seven bridges (see Figure [[#fig:Königsberg_bridges|2]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Königsberg_bridges&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Konigsberg_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The problem is to find a walk path that would cross each of the seven bridges only once.&lt;br /&gt;
&lt;br /&gt;
Leonhard Euler has resolved the problem in 1736 by showing that such a walk path does not exist. His solution founded the graph theory and therefore the Seven Bridges of Königsberg problem is considered to be the first problem of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graphs-theory-basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Graphs theory basics ==&lt;br /&gt;
&lt;br /&gt;
A graph is a mathematical object consisting of vertices (nodes) and edges connecting pairs of vertices, see example in Figure [[#fig:exa_undirected_graph|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_undirected_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_undirected_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Graph theory studies properties of graphs and problems which can be described by means of graphs. Graph theoretical algorithms and results are applied in many areas, like e.g. transport networks, computer science or biology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basics ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Basic terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A graph is composed of vertices (nodes) and edges connecting pairs of vertices. Vertex and edge are the two basic units of the graph. The set of vertices and edges is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{V}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;, respectively. In undirected graph the edges have no direction, they simple connect two vertices. The graph shown in Figure [[#fig:exa_undirected_graph|3]] is an example of an undirected graph.&lt;br /&gt;
&lt;br /&gt;
The degree of a vertex is the number of edges connected to it. A path is an uninterrupted line connecting two vertices over sequence of edges and vertices. For example the path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,5,6)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] connects the vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;. This way a path is specified by an ordered list of all vertices locating on the uninterrupted line going from the starting vertex of the path to the end vertex of it. A cycle is a path, whose start vertex and end vertex is the same. For example &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,3,4,1)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] is a cycle. A graph is called connected graph, if there is a path between any two vertices of the graph. For example the graph in Figure [[#fig:exa_undirected_graph|3]] is a connected graph.&lt;br /&gt;
&lt;br /&gt;
In the weighted graph each edge has a weight (or cost) associated to them. This weight can represent different physical properties, like e.g. distance between two nodes, capacity of a network link, transport cost of a way between two nodes, etc. An example of a weighted graph can be seen in Figure [[#fig:exa_weighted_graph|4]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_weighted_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_weighted_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Types of graphs&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The classification of graphs into various types is based on the properties of the considered subclass of graphs. The most important types of graphs together with their definitions are given as follows.&lt;br /&gt;
&lt;br /&gt;
* Undirected graph - A graph with edges having no direction.&lt;br /&gt;
* Directed graph - A graph with edges having direction.&lt;br /&gt;
* Unweighted graph - A graph with edges having no weights associated to them.&lt;br /&gt;
* Weighted graph - A graph with edges having weights associated to them.&lt;br /&gt;
* Connected graph - A graph having path between any two of its vertices.&lt;br /&gt;
* Disconnected graph - A graph containing at least one pair of vertices having no path between them.&lt;br /&gt;
* Cyclic graph - A graph containing at least one cycle.&lt;br /&gt;
* Acyclic graph - A graph does not containing any cycles.&lt;br /&gt;
* Tree - A connected acyclic graph.&lt;br /&gt;
* Multi-graph - A graph containing at least one pair of vertices having multiple edges between them.&lt;br /&gt;
* Simple graph - A graph without cycles and multiple edges between the same pair of vertices.&lt;br /&gt;
* Complete graph - A graph in which each pair of vertices is connected by edge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Graph descriptions&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most often used graph representations in algorithms are&lt;br /&gt;
&lt;br /&gt;
* adjacency matrix and&lt;br /&gt;
* adjacency list,&lt;br /&gt;
&lt;br /&gt;
because they enable the mathematical description of graphs by means of programming variables, like matrix, array and list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency matrix&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adjacency matrix is suitable to describe unweighted graphs, both undirected and directed ones. Adjacency matrix is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V \times V&amp;lt;/math&amp;gt; matrix, whose &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element describes the existence of the connection from vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; as a binary value. If there is a connection then this value equals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. For example the adjacency matrix of the undirected, unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] looks like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left(&lt;br /&gt;
    \begin{array}{llllll}&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&lt;br /&gt;
    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right).&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The construction of the adjacency matrix implies that the adjacency matrix of an undirected graph is always a symmetric matrix. The idea of describing an unweighted graph by constructing an adjacency matrix as 2-dimensional array can be theoretically extended to describe a weighted graph by constructing a 3-dimensional array, in which the third dimension represents the weight assigned to the edge specified by the first two dimensions. Such a 3-dimensional could be called as adjacency tensor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another way of mathematical representation of a graph is the adjacency list. Adjacency list is an array of lists, in which each list specifies a set of neighbours of a vertex assigned to the actual list as index of the array. In describing a weighted graph, the list consists of the comma separated sequence of &amp;amp;quot;ending vertex: weight&amp;amp;quot; pairs, where each such pair specifies an edge to the given ending vertex with the given weight starting from the vertex to which the considered list belongs to. In case of an unweighted graph the list is a comma separated sequence of neighbour vertexes of the vertex to which the considered list belongs to. Therefore this type of representation is suitable to describe both unweighted and weighted graphs. For example the adjacency list of the unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2,4\} \\&lt;br /&gt;
2: &amp;amp; \{1,3,5\}\\&lt;br /&gt;
3: &amp;amp; \{2,4\} \\&lt;br /&gt;
4: &amp;amp; \{1,3,5\} \\&lt;br /&gt;
5: &amp;amp; \{2,4,6\} \\&lt;br /&gt;
6: &amp;amp; \{5\}&lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly the adjacency list of the weighted graph example in Figure [[#fig:exa_weighted_graph|4]] can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2:5,3:2\} \\&lt;br /&gt;
2: &amp;amp; \{1:5,3:3,4:4\}\\&lt;br /&gt;
3: &amp;amp; \{1:2,2:3,4:1\} \\&lt;br /&gt;
4: &amp;amp; \{2:4,3:1,5:3\} \\&lt;br /&gt;
5: &amp;amp; \{1:8,4:3\} &lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Edge list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Still another way of mathematically describing a graph is to specify it as edge list. Each edge is specified by a sequence in the form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[&amp;lt;/math&amp;gt; starting vertex, ending vertex, weight (optional) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;]&amp;lt;/math&amp;gt;. Thus the edge list can be given as a two/three column matrix for unweighted/weighted graphs. Hence this type of representation is suitable to describe both unweighted and weighted graphs. The unweighted graph in Figure [[#fig:exa_undirected_graph|3]] and the weighted graph in Figure [[#fig:exa_weighted_graph|4]] can be described by edge list, respectively, as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2], [2,3], [1,4], [4,5], [2,5], [3,4], [5,6] ]  \\&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2,5], [2,3,3], [3,1,2], [2,4,4], [4,3,1], [1,5,8], [4,5,3] ]. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graph-problems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Graph problems ===&lt;br /&gt;
&lt;br /&gt;
Graph theory can be applied for solving different problems in many areas. Without claim for completeness we list several well-known graph problems with their brief description.&lt;br /&gt;
&lt;br /&gt;
* Graph coloring - Graph coloring is a group of problems all of them having something to do with coloring of graphs. Usually they are specified by means of a restriction on the way of coloring, like e.g no adjacent vertices may have the same color. One of the famous result in graph coloring is the so called [https://en.wikipedia.org/wiki/Four_color_theorem Four-color theorem]&lt;br /&gt;
* Network flow problems - Network flow problems deal with question related to [https://en.wikipedia.org/wiki/Flow_network Flow networks].&lt;br /&gt;
* Covering problems - Covering problems are set cover problems dealing with covering some subsets of vertices/subgraphs. Vertex cover problem is a special case of set cover problems, in which for every edge its starting or end vertex is in the vertex cover.&lt;br /&gt;
* Route problems - Route problems are graph problems, which are all related to find a route specified by various constraints on the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Route problems&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Route problems form an important class of graph problems, since they have applications in many areas. Here is a list of several selected Route problems, which will be discussed in more details in the rest of this section.&lt;br /&gt;
&lt;br /&gt;
# Hamiltonian path and Eulerian path&lt;br /&gt;
# Traveling salesman problem&lt;br /&gt;
# Chinese postman problem (Route inspection problem)&lt;br /&gt;
# Minimum spanning tree&lt;br /&gt;
# Shortest path problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-vertex-cover-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum Vertex Cover Problem  ==&lt;br /&gt;
&lt;br /&gt;
Vertex cover problem is a kind of set cover problems, in which a set of vertices are searched, which includes at least one endpoint of every edge of the graph. The Minimum Vertex Cover Problem (MIN-VC) is a vertex cover problem on undirected graph, in which a set of minimum number of vertices are searched, which includes at least one endpoint of every edge of the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_minvc&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_minvc.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the minimum vertex cover of the example graph in Figure [[#fig:exa_graph_minvc|5]] is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,4\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,4,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{1,3,5\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The MIN-VC is an optimization problem and it can be reformulated to a decision problem, which is also called as &amp;amp;quot;vertex cover problem&amp;amp;quot;. It is known to be [https://en.wikipedia.org/wiki/NP-completeness NP-complete] (nondeterministic polynomial-time complete), so usually so it cannot be solved by a polynomial-time algorithm.&lt;br /&gt;
&lt;br /&gt;
There is an approximate algorithm for determining the minimum vertex cover of an undirected graph. Its schematic representation is shown in Algorithm 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 1 Approximate algorithm for MIN-VC&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph given by an edge list (= set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;).&amp;lt;br /&amp;gt;&lt;br /&gt;
Output : Found set of vertex cover &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise set of vertex cover: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;=&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; is not empty&amp;lt;br /&amp;gt;&lt;br /&gt;
3   Take an arbitrary edge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(u,v)&amp;lt;/math&amp;gt; from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   Remove all edges from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; having endpoint either &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It can be proven that the above approximate algorithm for MIN-VC always finds a vertex cover whose size is not more than twice of the size of the minimum vertex cover. The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;. The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|&amp;lt;/math&amp;gt; The memory is needed to store the visited vertices, i.e. the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-hamiltonian-path&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Eulerian path and Hamiltonian path ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eulerian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. Note that the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted. However this does not affect the mathematical treatment of Eulerian path, therefore we treat these cases commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for for the existence of Eulerian path in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Either none of the vertices or exactly two vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have odd degree and all its other vertices have even degree.&lt;br /&gt;
&lt;br /&gt;
Along the Euler path, each time walking through a vertex we walking through two previously unseen edges: one at approaching the vertex and the other at leaving it. On this way the number of edges at each middle vertex (i.e. the vertices except the starting and ending vertices of the path) must be even. The starting and ending vertices of the path are enabled to have odd degree, as the start or finish of the walk goes through on only one edge connected to that vertices. This argument proves the necessity of the condition. It turns out that the condition is also sufficient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-path&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-path.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_graph_E-path|6]] has an Euler path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,3,4,5,2,4)&amp;lt;/math&amp;gt;, since only vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree.&lt;br /&gt;
&lt;br /&gt;
An Euler path can be determined by going through the graph starting from a vertex with odd degree and selecting always previously unseen edges at each vertices. The conditions ensure that this always leads to an Euler path. This process requires the logging of the already visited edges at each vertex. It follows that the computational complexity of finding an Euler path is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Seven Bridges of Königsberg is a problem of finding an Euler path. In fact Leonard Euler solved it in 1736 by showing that there is no path that visits every of the seven bridges exactly once. His solution applies the above argument for necessary condition. Euler’s solution of the Königsberg bridge problem is the first theorem of graph theory and laid the foundations of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian cycle in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. Similarly to Eulerian path, the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted, which does not affect of the mathematical treatment of Eulerian cycle. Hence these cases are treated commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. A graph containing a Eulerian cycle is a Eulerian graph.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for the existence of Eulerian cycle in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be formulated as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
This can be argumented similarly as in case of Eulerian path. Because in case of Eulerian cycle the path returns to the starting vertex, no odd degree is allowed yet for that vertex.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_graph_E-path|6]] has no Eulerian cycle, since not every vertices have even degree (vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However the in the graph in Figure [[#fig:exa_graph_E-cycle|7]] every vertices have even degree, therefore it has a Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
Finding a Eulerian cycle can be completed on the same way as described for Eulerian path, but the visit can start at any vertex, since all vertices have even degree. Like in case of finding an Eulerian path, finding a Eulerian cycle has a computational complexity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Hamiltonian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. The path have not to return to the starting vertex, i.e. Hamiltonian path is an open path. Finding a Hamiltonian path is in general an NP-complete problem.&lt;br /&gt;
&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_undirected_graph|3]] has more Hamiltonian paths: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(3,2,1,4,5,6)&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,4,3,2,5,6)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* transportation networks (finding optimal routes),&lt;br /&gt;
* circuit design and&lt;br /&gt;
* graph theory research.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle (or Hamiltonian circuit) in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. A graph containing a Hamiltonian cycle is a Hamiltonian graph, otherwise it is non-Hamiltonian graph. Like in case of finding a Hamiltonian path, finding a Hamiltonian cycle is also an NP-complete problem. Finding a Hamiltonian path is often easier than finding a Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_undirected_graph|3]] has no Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_H_cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_H_cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However a slightly different graph in Figure [[#fig:exa_graph_H_cycle|8]] has a Hamiltonian cycle: (5,2,1,4,3,5).&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* computer science,&lt;br /&gt;
* logistics and&lt;br /&gt;
* network design.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algorithms for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the next we give a brief description of the following two algorithms for finding Hamiltonian cycle:&lt;br /&gt;
&lt;br /&gt;
* Brute-force search and&lt;br /&gt;
* Backtracing algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Brute-force search - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search (also called exhaustive search) follows a naive approach and tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequences of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Backtracing algorithm - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of Backtracing algorithm is to add iteratively a new vertex to the actual path of subsequence of vertices, which is an adjacent to the last vertex of the actual path and not yet included in that path. After having the path with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices, it is checked whether it composes a cycle or not. If not then change the path by trying systematically all the adjacent vertices at every position in the path backwards, which is called backtracking.&lt;br /&gt;
&lt;br /&gt;
The algorithm can be implemented on elegant way by applying a recursive function call. The pseudo code of the algorithm is given in Algorithm 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 2 Backtracing algorithm - for finding Hamiltonian cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if Hamiltonian cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if Hamiltonian cycle exist&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]&amp;lt;/math&amp;gt;= first vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
3 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Recursive function&amp;lt;br /&amp;gt;&lt;br /&gt;
bool try_next_vertex_and_check_cycle(path_index k)&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: next index in the path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if backtracking or cycle not exists&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k == |\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2   if exists edge between last and first vertices of path&amp;lt;br /&amp;gt;&lt;br /&gt;
3     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
4   else&amp;lt;br /&amp;gt;&lt;br /&gt;
5     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v \in \mathcal{V}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is adjacent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k-1]&amp;lt;/math&amp;gt; (=last vertex in path)&amp;lt;br /&amp;gt;&lt;br /&gt;
9    and&amp;lt;br /&amp;gt;&lt;br /&gt;
10  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is not yet in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11    path[k]=v&amp;lt;br /&amp;gt;&lt;br /&gt;
12    if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(k+1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13      return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14    end&amp;lt;br /&amp;gt;&lt;br /&gt;
15    (Backtracking - remove v from path)&amp;lt;br /&amp;gt;&lt;br /&gt;
16    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k] = -1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
17  end&amp;lt;br /&amp;gt;&lt;br /&gt;
18 end&amp;lt;br /&amp;gt;&lt;br /&gt;
19 return false (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the course of backtracking every neighbours of every vertices can be tried by the algorithm. Therefore its computational complexity is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;chinese-postman-problem-route-inspection-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Chinese postman problem (Route inspection problem) ==&lt;br /&gt;
&lt;br /&gt;
The Chinese postman problem (also called as route inspection problem) is an extension of finding Eulerian cycle in connected and (unweighted or weighted) undirected graphs. The Chinese postman problem is to find shortest path that visits every edge of the connected and undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; at least once and return to the starting vertex. So the problem is defined on connected graph. The shortest path is defined as the one with minimum number of edges for unweighted graph and as the path with minimum accumulated weights for weighted graph. The solution path of Chinese postman problem is called Chinese postman tour. The Chinese postman problem can be solved in polynomial time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; contains an Eulerian cycle, then it is also the solution for the Chinese postman problem, since Eulerian cycle has the shortest path (minimum number of edges in unweighted graph and minimum accumulated weights in weighted graph) due to the necessity of visiting all edges at least once.&lt;br /&gt;
&lt;br /&gt;
Therefore the necessary and sufficient condition for the solution for the Chinese postman problem to be the Eulerian cycle is the existence of Eulerian cycle, which can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
For example graph in Figure [[#fig:exa_graph_E-cycle|7]] the solution, i.e the Chinese postman tour is the Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-non-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Non-Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; has no Eulerian cycle, then the graph must be extended to become Eulerian. This is done by duplicating some edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; connected to vertices with odd degree in order to change the degree of all these vertices become to even. The edges to be duplicated must be selected from the relevant ones (i.e. connected to vertices with odd degree) on that way, that the increase of the path length due to edge duplication must be the possible smallest. Therefore those pairing of the vertices with odd degree are selected, which have the shortest path connecting them.&lt;br /&gt;
&lt;br /&gt;
The example unweighted graph in Figure [[#fig:exa_graph_cpp_unweighted|9]] shows a Non-Eulerian graph and the Chinese postman tour obtained by duplicating the edges [2,4] and [3,1].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_unweighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_unweighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Similarly the example Non-Eulerian weighted graph in Figure [[#fig:exa_graph_cpp_weighted|10]] illustrates the construction of the Chinese postman by duplicating the edges [2,4], [4,6] and [5,1]. Here duplicating [2,4] together with [4,6] instead of [2,6] inserts shorter path (i.e. accumulated weight 2+1= 3 instead of 5). Similarly duplicating [5,1] instead of [5,3] together with [3,1] inserts shorter path (i.e. accumulated weight 1 instead of 1+2=3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_weighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_weighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithm-for-chinese-postman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithm for Chinese postman problem ===&lt;br /&gt;
&lt;br /&gt;
Based on the above considerations the algorithm for finding the Chinese postman route can be given schematically by means of its steps in Algorithm 3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 3 Algorithm for Chinese postman problem&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Chinese postman route.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if grap &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is Eulerian&amp;lt;br /&amp;gt;&lt;br /&gt;
2    Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    return Eulerian cycle and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Find all vertices with odd degree and store in array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;oddVertices&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Construct the complete graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt; from odd vertices together with edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt;representing shortest paths among any pairs of odd vertices&amp;lt;br /&amp;gt;&lt;br /&gt;
9    Find minimum weight perfect matching in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt;, i.e the set of edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; reaching every odd vertices and together having smallest sum of weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; This set of edges is called minimum T-join.&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Extend the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; by adding all edges from minimum T-join&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; resulting in extended graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
12   Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14   return Eulerian cycle of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The numerical complexity of the above minimum T-join based algorithm for solving the Chinese postman problem is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, since both setting up the complete graph, and finding minimum weight perfect matching in it takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt; computational steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-spanning-tree---kruskals-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum spanning tree - Kruskal’s algorithm ==&lt;br /&gt;
&lt;br /&gt;
A spanning tree of a graph is a tree including every vertices of the graph. The number of edges of a spanning tree is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt;, since the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt;-th edge would introduce a cycle and it were not any more a tree.&lt;br /&gt;
&lt;br /&gt;
The minimum spanning tree (MST) is defined for a weighted, undirected, connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;, as a spanning tree with the minimal accumulated weights.&lt;br /&gt;
&lt;br /&gt;
Kruskal’s algorithm can be used to determine the MST of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. In the Kruskal’s algorithm all edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; are sorted according to their weights in increasing order. Then the algorithm iteratively adds the next edge from the sorted list, i.e. the edge with the smallest weight, together with their vertexes to MST, if the newly added edge does not induce a cycle. The algorithm proceeds until every edge on the list is checked. On this way the resulted graph will have &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt; edge, so it will be a spanning tree and the way of constructing implies that it will have the least accumulated weights.&lt;br /&gt;
&lt;br /&gt;
The algorithm takes in each step the locally optimal decision due to adding the edge with the smallest weight among the still available ones. Therefore Kruskal’s algorithm is a greedy algorithm.&lt;br /&gt;
&lt;br /&gt;
The algorithm is shown schematically in Algorithm 4.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 4 Kruskal’s algorithm for detrmining MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: MST of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise graph MST to be set empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Sort every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; in increasing weight order and insert them,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; together with their vertexes into array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=0,\ldots size(sortedListEdges)-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    if inserting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST does not induce a cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
5      Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST&amp;lt;br /&amp;gt;&lt;br /&gt;
6    end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt;, since sorting the edges has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; complexity, iterating through every edges and checking cycle has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|) =\mathcal{O}(log(|\mathcal{E}|)&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{E}|&amp;lt;/math&amp;gt; is at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;, which is needed to store edges together with their vertexes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;traveling-salesman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Traveling salesman problem ==&lt;br /&gt;
&lt;br /&gt;
The Traveling Salesman Problem (TSP) originates from a context of cities and given distances among them. TSP is to look for the shortest path that goes through each city exactly once and returns to the starting city. Usually there exists a route between any pair of cities with some given distance. In graph theory context an equivalent formulation of TSP can be given as looking for a path with the least accumulated weights in a weighted, often complete graph, that goes through each vertex exactly once and returns to the starting vertex. This is equivalent with finding the Hamiltonian cycle with the minimum accumulated weight in a weighted, often complete graph. Thus the TSP is more general than Hamilton cycle problem and hence Hamilton cycle problem is a special case of TSP. The resulted path can be also called as TSP path.&lt;br /&gt;
&lt;br /&gt;
The TSP was formulated mathematically in the 19th century and was first studied mathematically in the 1930s. The decision problem version of TSP is an NP-complete problem, so TSP is NP-hard. TSP is one of the most intensively investigated problem in combinatorial optimization, since it is used as benchmark for other optimization methods in terms of computational complexity.&lt;br /&gt;
&lt;br /&gt;
Some properties of TSP can be provided as&lt;br /&gt;
&lt;br /&gt;
* Symmetric and asymmetric TSP. In symmetric TSP the distance between two cities is the same in both direction, which leads to a formulation in graph theory context to a TSP on undirected graph. In asymmetric TSP either do not exist a path between two cities in both direction or the distances are different excluding the higher one from the TSP formulation. In these cases the formulation in graph theory context yileds a TSP on directed graph.&lt;br /&gt;
* Completing the graph by adding edges with sufficiently long distances will not affect the optimal path.&lt;br /&gt;
* The path to be a cycle or an open path does not make difference in the computational complexity of TSP (like in case of Hamilton path problem).&lt;br /&gt;
&lt;br /&gt;
The TSP has applications in numerous fields, like logistics, route planning in transport networks, manufacturing of microchips and DNA sequencing. One-way streets, airfares with different departure and arrival fees are real-world scenarios for applying asymmetric TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;generalizations-of-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Generalizations of TSP ===&lt;br /&gt;
&lt;br /&gt;
Several generalizations of TSP are listed below.&lt;br /&gt;
&lt;br /&gt;
* The travelling politician problem (also called as &amp;amp;quot;generalized travelling salesman problem&amp;amp;quot;) has a context with states having one or more cities and the travelling man must visit exactly one city from each state. It has been shown that travelling politician problem can be led back to standard TSP with modified distance matrix.&lt;br /&gt;
* The travelling purchaser problem has a purchaser, who has to buy a set of products, which can be bought in more cities but at different prices. The optimization objective is to find a path among a subset of cities that enables to buy all the products with minimal total cost (=taveling cost + purchasing cost).&lt;br /&gt;
* Vehicle routing problem.&lt;br /&gt;
* Ring star problem ([Labbé et al.(2004)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;integer-linear-programming-formulation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Integer linear programming formulation ===&lt;br /&gt;
&lt;br /&gt;
In order to form the TSP as Integer Linear Programming (ILP) optimization, several variables must be introduced. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; denote the number of cities (vertices), i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N = |\mathcal{V}|&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_{ij}&amp;lt;/math&amp;gt; stand for the distances (weights) between the cities (vertices) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}&amp;lt;/math&amp;gt; be a decision variable describing whether the path goes from city (vertix) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, or not for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;x_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~path~goes~i \rightarrow j}  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~~~~~~~~~~~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\}.&amp;lt;/math&amp;gt; The integer nature of the values &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; makes this optimization problem an ILP. The objective function of the optimization task is to minimize the path length (= accumulated weights), in other word&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij} ~j = 1, \ldots, N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However without further constraints this optimization considers not only paths, which are characterized by also leaving each reached vertex, but all set of edges enabling the minimum being at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j \in \mathcal{V}&amp;lt;/math&amp;gt;. Therefore further constraints are necessary to ensure that paths are considered and each vertex is visited exactly once. These requirements can be forced by formulating the following further two constraints, which force that the path reaches each vertex exactly once and leaves each vertex exactly once &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N, \\&lt;br /&gt;
\sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constraints ensure that the selected way looks locally as path and all vertices are visited, but still allow that the selected set of edges comprises several local paths each of them visiting only a disjunct subset of vertices instead of one global path visiting every vertices. This global path requirement makes TSP a difficult problem. There are more ways to formulate this global path requirement as a linear constraint. The Miller-Tucker-Zemlin formulation introduces dummy variables &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; for keeping track the order of visit the city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 1, \ldots, N&amp;lt;/math&amp;gt;. The path starts with visiting city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. The global path requirement is ensured by forcing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; being higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; is visited before city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 2, \ldots, N&amp;lt;/math&amp;gt;. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; must be higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; at least by one when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; locates on the path after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, and otherwise by a values less than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; to ensure that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; does not force an unwanted relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt;. Since city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is left out from these constraint, it ensures that the optimal path must return to city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise the value of the dummy variable of the city visited after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N-1&amp;lt;/math&amp;gt; would be less that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_{N-1}&amp;lt;/math&amp;gt;, which would violate the constraint. The city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is the only one for which a decrease in value of the dummy variable allowed when the path reaches city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. These considerations lead to the formulation of the global path requirement as a linear constraint as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting all these together gives the Miller-Tucker-Zemlin ILP formulation of the TSP as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij},~\ldots, N, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~subject~to} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}1.~~~ \sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N,  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}2.~~~ \sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N,  \mathrm{~and~} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\ &lt;br /&gt;
\mathrm{~constraint~}3.~~~ u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithms-for-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithms for TSP ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Exact algorithm - Brute-force search&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices and selects the one with the lowest accumulated weights. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequence of vertices the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;. Hence this approach becomes intractable already for number of cities in the magnitude of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;20&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Approximate algorithms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the NP-completeness of the TSP the exact solution becomes intractable very fast as the number of cities increases. Therefore there is a need for establishing approximate algorithms for the TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Nearest neighbour algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nearest Neighbour (NN) algorithm selects the nearest not yet visited neighbour city at each step. Thus its decision is locally optimal in each step, therefore it is a greedy algorithm. Its schematic representation is shown in Algorithm 5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 5 Nearest neighbour approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Hamiltonian cycle with minimum accumulated weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]=1&amp;lt;/math&amp;gt; and set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array =sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=1,\ldots N-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Select nearest not yet visited city among neighbours of city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v-1]&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v]=u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight += weight(path[v-1], u)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the NN algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|)&amp;lt;/math&amp;gt;. For city arrangement distributed randomly on the plane, the NN algorithms gives a path which is only 25% longer than the shortest one. However for specific city arrangements the NN algorithm can produce also the worst route.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Christofides algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heuristic approach of Christofides is based on using graph theoretical results to compose an approximate algorithm. It utilizes that a TSP path can not be longer than an Eulerian path over all cities of the graph. Therefore first a subgraph including all cities must be found, than it is extended to be an Eulerian graph, afterwards the Eulerian path is determined in the Eulerian graph and finally it is converted to a TSP path (i.e. to visit each city only once). If the minimum spanning tree of the original graph is selected as first graph and it is made to be an Eulerian graph by doubling every edge in it, then the total length of an Eulerian path can not be more than twice the one of the TSP path. Note that the length of the path changes also at converting the Eulerian path to a TSP path. During this step, shortcut is created for each city visited twice by inserting an edge from the city before this to a city after this. On this way one can approximate a solution for the TSP. The steps of the Christofides algorithm are shown schematically in Algorithm 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 6 Christofides approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Duplicate every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; to create an Eulerian graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find an Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Christofides algorithm was one of the first approximation algorithm, which shown that establishing an approximation algorithms can be practically usable approach for solving exactly intractable problems.&lt;br /&gt;
&lt;br /&gt;
An improved version of the algorithm is the algorithm of Christofides and Serdyukov, in whic a better way of creating an Eulerian graph is applied. This is done by applying the so called minimum weight matching. The steps of the algorithm of Christofides and Serdyukov can be seen schematically in Algorithm 7.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 7 Approximate algorithm of Christofides and Serdyukov for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Apply minimum weight matching to odd-degree vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; giving graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find optimal Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Approximate algorithm of Christofides and Serdyukov gives an approximate TSP path with accumulated weights, which is at most 1,5 times higher than the one of the optimal TSP path. The computational complexity of the approximate algorithm of Christofides and Serdyukov is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, which is mainly caused by minimum weight matching algorithm part.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;shortest-path-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Shortest path problem  ==&lt;br /&gt;
&lt;br /&gt;
The shortest path in a weighted graph between two vertices is the path connecting them with the smallest accumulated weight. There are more algorithm for finding shortest path, each with a slightly different applicability scope.&lt;br /&gt;
&lt;br /&gt;
Besides of Diskstra’s algoritm another common algorithms are the [https://en.wikipedia.org/wiki/Bellman-Ford_algorithm Bellman-Ford] and the [https://en.wikipedia.org/wiki/Floyd-Warshall_algorithm Floyd Warshall] algorithms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;dijkstra-algorithmus&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Dijkstra-Algorithmus ===&lt;br /&gt;
&lt;br /&gt;
Diskstra’s algorithm finds the shortest path from a given source vertex to every vertices in a weighted graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. The graph must not contain negative edge, since in that case the algorithm fails.&lt;br /&gt;
&lt;br /&gt;
The idea of Diskstra’s algorithm is an iterative extension of shortest path tree (SPT) containing a subtree with vertices, for which the shortest paths from the a given source have already been found. The vertices outside of SPT have also minimum distance values assigned during the intermediate steps of the processing. The minimum distance values of vertices being neighbour of any vertices of SPT and locating outside of SPT represent the minimum distance from source vertex to the considered vertex via every possible routes over the vertices of the actual SPT. The iterative extension of SPT is performed by selecting the vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with the shortest minimum distance among the vertices locating outside of SPT, adding this vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; together with its minimum distance to SPT and reevaluating the minimum distances of each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; locating outside of the updated SPT and being the neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;. During the reevaluation the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is compared to the sum (minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)) and if the later is smaller then the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; will be updated.&lt;br /&gt;
&lt;br /&gt;
The schematical representation of the algorithm can be seen in Algorithm 8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 8 Dijkstra-Algorithmus for determining SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
- Source vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Array of minimum distances to every vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Create an adjacenty matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; for maintaining SPT with vertices (subtree),&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;for which the shortest paths from the a given source have already been found&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and initialize it to empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; stores already found minimum distance values for its vertices.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Create and adjacency matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; for representing the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being a&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;subgraph of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; containing vertices locating outside of SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and every edges of them. Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; stores also actual values of&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;minimum distance to every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Initialize all these distance values to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt;, and for the source vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;set the minimum distance to the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is not empty (=not all vertices are moved from it)&amp;lt;br /&amp;gt;&lt;br /&gt;
4    take a vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with the smallest minimum distance&amp;lt;br /&amp;gt;&lt;br /&gt;
5    add vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with its minimum distance and its edge connecting it to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
6     matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7      for each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8        (update minimum distance of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; in matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: )&amp;lt;br /&amp;gt;&lt;br /&gt;
9        if minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;) &amp;amp;lt; minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
10         minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; = minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
11         mark edge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; as edge connecting to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
12       end&amp;lt;br /&amp;gt;&lt;br /&gt;
13     end&amp;lt;br /&amp;gt;&lt;br /&gt;
14     remove the row of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15      (that means also removing vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
16 end&amp;lt;br /&amp;gt;&lt;br /&gt;
17 Build up array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt; from SPT matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
18 return array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt;, since finding the vertex in the subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))&amp;lt;/math&amp;gt; operations, which must be done for every vertices. Note that it is the same as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))= \mathcal{O}(log(|\mathcal{E}|))&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The finding the vertex of subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; with the smallest minimum distance can be implemented by the help of priority queue (or Heap). The standard usage of priority queue would overwrite minimum distance in the inserted pair (minimum distance - vertex) for the same vertex always by the minimum distance of the lastly checked edge to that vertex, which is not necessarily the smallest one among every edges. This can be resolved by inserting more copies of the pair (minimum distance - vertex) for the same vertex, since priority queue will take only the one of them with the smallest value of minimum distance.&lt;br /&gt;
&lt;br /&gt;
Dijkstra’s algorithm assumes that in each intermediate step, the minimum distances of the vertices in SPT, are already the final ones, i.e. the shortest paths from the a given source to the vertices of SPT have already been found. This holds with non- negative weight, since in this case a new path to a vertex in SPT via any vertices of outside of SPT would increase the distance by a sum of non-negative weights which then can not be smaller then the distance marked in SPT as the minimum one. However this is not true in case of existence of negative weight, and thus for graphs with negative weights Dijkstra’s algorithm can return higher distance than than the real minimal one, i.e. wrong result. This is illustrated on the graph in Figure [[#fig:exa_graph_neg_weight|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_neg_weight&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_neg_weight]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For this graph Dijkstra’s algorithm would give minimum distance for node &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;, which is wrong, since the right value is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;5&amp;lt;/math&amp;gt;, respectively&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6518</id>
		<title>Graph Theory and Algorithms</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Graph_Theory_and_Algorithms&amp;diff=6518"/>
		<updated>2025-03-04T22:36:34Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;graph-theory-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Graph Theory and Algorithms =  For a comprehensive subject on graph theory the reader is referred to the book [Gross and Yellen(1998)].  &amp;lt;span id=&amp;quot;seven-bridges-of-königsberg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Seven Bridges of Königsberg ==  Seven Bridges of Königsberg is a problem of mathematics formulated by Leonhard Euler after a walk in Königsberg in Prussia (now Kaliningrad, Russia). The islands were connected to each ot…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;graph-theory-and-algorithms&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Graph Theory and Algorithms =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on graph theory the reader is referred to the book [Gross and Yellen(1998)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;seven-bridges-of-königsberg&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Seven Bridges of Königsberg ==&lt;br /&gt;
&lt;br /&gt;
Seven Bridges of Königsberg is a problem of mathematics formulated by Leonhard Euler after a walk in Königsberg in Prussia (now Kaliningrad, Russia). The islands were connected to each other and the mainlands on the two sides of the Pregel River via seven bridges (see Figure [[#fig:Königsberg_bridges|2]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Königsberg_bridges&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Konigsberg_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The problem is to find a walk path that would cross each of the seven bridges only once.&lt;br /&gt;
&lt;br /&gt;
Leonhard Euler has resolved the problem in 1736 by showing that such a walk path does not exist. His solution founded the graph theory and therefore the Seven Bridges of Königsberg problem is considered to be the first problem of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graphs-theory-basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Graphs theory basics ==&lt;br /&gt;
&lt;br /&gt;
A graph is a mathematical object consisting of vertices (nodes) and edges connecting pairs of vertices, see example in Figure [[#fig:exa_undirected_graph|3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_undirected_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_undirected_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Graph theory studies properties of graphs and problems which can be described by means of graphs. Graph theoretical algorithms and results are applied in many areas, like e.g. transport networks, computer science or biology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;basics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Basics ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Basic terms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A graph is composed of vertices (nodes) and edges connecting pairs of vertices. Vertex and edge are the two basic units of the graph. The set of vertices and edges is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{V}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;, respectively. In undirected graph the edges have no direction, they simple connect two vertices. The graph shown in Figure [[#fig:exa_undirected_graph|3]] is an example of an undirected graph.&lt;br /&gt;
&lt;br /&gt;
The degree of a vertex is the number of edges connected to it. A path is an uninterrupted line connecting two vertices over sequence of edges and vertices. For example the path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,5,6)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] connects the vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;. This way a path is specified by an ordered list of all vertices locating on the uninterrupted line going from the starting vertex of the path to the end vertex of it. A cycle is a path, whose start vertex and end vertex is the same. For example &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,2,3,4,1)&amp;lt;/math&amp;gt; in Figure [[#fig:exa_undirected_graph|3]] is a cycle. A graph is called connected graph, if there is a path between any two vertices of the graph. For example the graph in Figure [[#fig:exa_undirected_graph|3]] is a connected graph.&lt;br /&gt;
&lt;br /&gt;
In the weighted graph each edge has a weight (or cost) associated to them. This weight can represent different physical properties, like e.g. distance between two nodes, capacity of a network link, transport cost of a way between two nodes, etc. An example of a weighted graph can be seen in Figure [[#fig:exa_weighted_graph|4]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_weighted_graph&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_weighted_graph.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Types of graphs&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The classification of graphs into various types is based on the properties of the considered subclass of graphs. The most important types of graphs together with their definitions are given as follows.&lt;br /&gt;
&lt;br /&gt;
* Undirected graph - A graph with edges having no direction.&lt;br /&gt;
* Directed graph - A graph with edges having direction.&lt;br /&gt;
* Unweighted graph - A graph with edges having no weights associated to them.&lt;br /&gt;
* Weighted graph - A graph with edges having weights associated to them.&lt;br /&gt;
* Connected graph - A graph having path between any two of its vertices.&lt;br /&gt;
* Disconnected graph - A graph containing at least one pair of vertices having no path between them.&lt;br /&gt;
* Cyclic graph - A graph containing at least one cycle.&lt;br /&gt;
* Acyclic graph - A graph does not containing any cycles.&lt;br /&gt;
* Tree - A connected acyclic graph.&lt;br /&gt;
* Multi-graph - A graph containing at least one pair of vertices having multiple edges between them.&lt;br /&gt;
* Simple graph - A graph without cycles and multiple edges between the same pair of vertices.&lt;br /&gt;
* Complete graph - A graph in which each pair of vertices is connected by edge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Graph descriptions&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most often used graph representations in algorithms are&lt;br /&gt;
&lt;br /&gt;
* adjacency matrix and&lt;br /&gt;
* adjacency list,&lt;br /&gt;
&lt;br /&gt;
because they enable the mathematical description of graphs by means of programming variables, like matrix, array and list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency matrix&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Adjacency matrix is suitable to describe unweighted graphs, both undirected and directed ones. Adjacency matrix is a &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V \times V&amp;lt;/math&amp;gt; matrix, whose &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(i,j)&amp;lt;/math&amp;gt;-th element describes the existence of the connection from vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; as a binary value. If there is a connection then this value equals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;. For example the adjacency matrix of the undirected, unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] looks like&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \left(&lt;br /&gt;
    \begin{array}{llllll}&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 0\\&lt;br /&gt;
    1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0\\&lt;br /&gt;
    0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0 &amp;amp; 1\\&lt;br /&gt;
    0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 0 &amp;amp; 1 &amp;amp; 0&lt;br /&gt;
    \end{array}&lt;br /&gt;
    \right).&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The construction of the adjacency matrix implies that the adjacency matrix of an undirected graph is always a symmetric matrix. The idea of describing an unweighted graph by constructing an adjacency matrix as 2-dimensional array can be theoretically extended to describe a weighted graph by constructing a 3-dimensional array, in which the third dimension represents the weight assigned to the edge specified by the first two dimensions. Such a 3-dimensional could be called as adjacency tensor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Adjacency list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another way of mathematical representation of a graph is the adjacency list. Adjacency list is an array of lists, in which each list specifies a set of neighbours of a vertex assigned to the actual list as index of the array. In describing a weighted graph, the list consists of the comma separated sequence of &amp;amp;quot;ending vertex: weight&amp;amp;quot; pairs, where each such pair specifies an edge to the given ending vertex with the given weight starting from the vertex to which the considered list belongs to. In case of an unweighted graph the list is a comma separated sequence of neighbour vertexes of the vertex to which the considered list belongs to. Therefore this type of representation is suitable to describe both unweighted and weighted graphs. For example the adjacency list of the unweighted graph example in Figure [[#fig:exa_undirected_graph|3]] is given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2,4\} \\&lt;br /&gt;
2: &amp;amp; \{1,3,5\}\\&lt;br /&gt;
3: &amp;amp; \{2,4\} \\&lt;br /&gt;
4: &amp;amp; \{1,3,5\} \\&lt;br /&gt;
5: &amp;amp; \{2,4,6\} \\&lt;br /&gt;
6: &amp;amp; \{5\}&lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similarly the adjacency list of the weighted graph example in Figure [[#fig:exa_weighted_graph|4]] can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\begin{array}{ll}&lt;br /&gt;
1: &amp;amp; \{2:5,3:2\} \\&lt;br /&gt;
2: &amp;amp; \{1:5,3:3,4:4\}\\&lt;br /&gt;
3: &amp;amp; \{1:2,2:3,4:1\} \\&lt;br /&gt;
4: &amp;amp; \{2:4,3:1,5:3\} \\&lt;br /&gt;
5: &amp;amp; \{1:8,4:3\} &lt;br /&gt;
\end{array}.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Edge list&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Still another way of mathematically describing a graph is to specify it as edge list. Each edge is specified by a sequence in the form &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[&amp;lt;/math&amp;gt; starting vertex, ending vertex, weight (optional) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;]&amp;lt;/math&amp;gt;. Thus the edge list can be given as a two/three column matrix for unweighted/weighted graphs. Hence this type of representation is suitable to describe both unweighted and weighted graphs. The unweighted graph in Figure [[#fig:exa_undirected_graph|3]] and the weighted graph in Figure [[#fig:exa_weighted_graph|4]] can be described by edge list, respectively, as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2], [2,3], [1,4], [4,5], [2,5], [3,4], [5,6] ]  \\&lt;br /&gt;
&amp;amp;&amp;amp;[ [1,2,5], [2,3,3], [3,1,2], [2,4,4], [4,3,1], [1,5,8], [4,5,3] ]. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;graph-problems&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Graph problems ===&lt;br /&gt;
&lt;br /&gt;
Graph theory can be applied for solving different problems in many areas. Without claim for completeness we list several well-known graph problems with their brief description.&lt;br /&gt;
&lt;br /&gt;
* Graph coloring - Graph coloring is a group of problems all of them having something to do with coloring of graphs. Usually they are specified by means of a restriction on the way of coloring, like e.g no adjacent vertices may have the same color. One of the famous result in graph coloring is the so called [https://en.wikipedia.org/wiki/Four_color_theorem Four-color theorem]&lt;br /&gt;
* Network flow problems - Network flow problems deal with question related to [https://en.wikipedia.org/wiki/Flow_network Flow networks].&lt;br /&gt;
* Covering problems - Covering problems are set cover problems dealing with covering some subsets of vertices/subgraphs. Vertex cover problem is a special case of set cover problems, in which for every edge its starting or end vertex is in the vertex cover.&lt;br /&gt;
* Route problems - Route problems are graph problems, which are all related to find a route specified by various constraints on the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Route problems&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Route problems form an important class of graph problems, since they have applications in many areas. Here is a list of several selected Route problems, which will be discussed in more details in the rest of this section.&lt;br /&gt;
&lt;br /&gt;
# Hamiltonian path and Eulerian path&lt;br /&gt;
# Traveling salesman problem&lt;br /&gt;
# Chinese postman problem (Route inspection problem)&lt;br /&gt;
# Minimum spanning tree&lt;br /&gt;
# Shortest path problem&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-vertex-cover-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum Vertex Cover Problem  ==&lt;br /&gt;
&lt;br /&gt;
Vertex cover problem is a kind of set cover problems, in which a set of vertices are searched, which includes at least one endpoint of every edge of the graph. The Minimum Vertex Cover Problem (MIN-VC) is a vertex cover problem on undirected graph, in which a set of minimum number of vertices are searched, which includes at least one endpoint of every edge of the graph.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_minvc&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_minvc.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the minimum vertex cover of the example graph in Figure [[#fig:exa_graph_minvc|5]] is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,4\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,3,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{2,4,5\}&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{1,3,5\}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The MIN-VC is an optimization problem and it can be reformulated to a decision problem, which is also called as &amp;amp;quot;vertex cover problem&amp;amp;quot;. It is known to be [https://en.wikipedia.org/wiki/NP-completeness NP-complete] (nondeterministic polynomial-time complete), so usually so it cannot be solved by a polynomial-time algorithm.&lt;br /&gt;
&lt;br /&gt;
There is an approximate algorithm for determining the minimum vertex cover of an undirected graph. Its schematic representation is shown in Algorithm 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 1 Approximate algorithm for MIN-VC&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph given by an edge list (= set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;).&amp;lt;br /&amp;gt;&lt;br /&gt;
Output : Found set of vertex cover &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise set of vertex cover: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;=&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\{\}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; is not empty&amp;lt;br /&amp;gt;&lt;br /&gt;
3   Take an arbitrary edge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(u,v)&amp;lt;/math&amp;gt; from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   Remove all edges from set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{E}&amp;lt;/math&amp;gt; having endpoint either &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It can be proven that the above approximate algorithm for MIN-VC always finds a vertex cover whose size is not more than twice of the size of the minimum vertex cover. The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;. The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|&amp;lt;/math&amp;gt; The memory is needed to store the visited vertices, i.e. the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{C}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-hamiltonian-path&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Eulerian path and Hamiltonian path ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eulerian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eulerian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. Note that the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted. However this does not affect the mathematical treatment of Eulerian path, therefore we treat these cases commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for for the existence of Eulerian path in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Either none of the vertices or exactly two vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have odd degree and all its other vertices have even degree.&lt;br /&gt;
&lt;br /&gt;
Along the Euler path, each time walking through a vertex we walking through two previously unseen edges: one at approaching the vertex and the other at leaving it. On this way the number of edges at each middle vertex (i.e. the vertices except the starting and ending vertices of the path) must be even. The starting and ending vertices of the path are enabled to have odd degree, as the start or finish of the walk goes through on only one edge connected to that vertices. This argument proves the necessity of the condition. It turns out that the condition is also sufficient.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-path&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-path.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_graph_E-path|6]] has an Euler path &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,3,4,5,2,4)&amp;lt;/math&amp;gt;, since only vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree.&lt;br /&gt;
&lt;br /&gt;
An Euler path can be determined by going through the graph starting from a vertex with odd degree and selecting always previously unseen edges at each vertices. The conditions ensure that this always leads to an Euler path. This process requires the logging of the already visited edges at each vertex. It follows that the computational complexity of finding an Euler path is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Seven Bridges of Königsberg is a problem of finding an Euler path. In fact Leonard Euler solved it in 1736 by showing that there is no path that visits every of the seven bridges exactly once. His solution applies the above argument for necessary condition. Euler’s solution of the Königsberg bridge problem is the first theorem of graph theory and laid the foundations of graph theory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eulerian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eulerian cycle in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that visits every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. Similarly to Eulerian path, the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be unweighted or weighted, which does not affect of the mathematical treatment of Eulerian cycle. Hence these cases are treated commonly by simple omitting unweighted or weighted characterization of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. A graph containing a Eulerian cycle is a Eulerian graph.&lt;br /&gt;
&lt;br /&gt;
The necessary and sufficient conditions for the existence of Eulerian cycle in the undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; can be formulated as&lt;br /&gt;
&lt;br /&gt;
* Every vertices with non-zero degree of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; form a connected graph.&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
This can be argumented similarly as in case of Eulerian path. Because in case of Eulerian cycle the path returns to the starting vertex, no odd degree is allowed yet for that vertex.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_graph_E-path|6]] has no Eulerian cycle, since not every vertices have even degree (vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; have odd degree).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_E-cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_E-cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However the in the graph in Figure [[#fig:exa_graph_E-cycle|7]] every vertices have even degree, therefore it has a Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
Finding a Eulerian cycle can be completed on the same way as described for Eulerian path, but the visit can start at any vertex, since all vertices have even degree. Like in case of finding an Eulerian path, finding a Eulerian cycle has a computational complexity of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;hamiltonian-path-and-cycle&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Hamiltonian path and cycle ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian path&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once. The path have not to return to the starting vertex, i.e. Hamiltonian path is an open path. Finding a Hamiltonian path is in general an NP-complete problem.&lt;br /&gt;
&lt;br /&gt;
For example the example graph in Figure [[#fig:exa_undirected_graph|3]] has more Hamiltonian paths: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(3,2,1,4,5,6)&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(1,4,3,2,5,6)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Hamiltonian path has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* transportation networks (finding optimal routes),&lt;br /&gt;
* circuit design and&lt;br /&gt;
* graph theory research.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle (or Hamiltonian circuit) in an undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is a closed path that goes through every vertex of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; exactly once and returns to the starting vertex. A graph containing a Hamiltonian cycle is a Hamiltonian graph, otherwise it is non-Hamiltonian graph. Like in case of finding a Hamiltonian path, finding a Hamiltonian cycle is also an NP-complete problem. Finding a Hamiltonian path is often easier than finding a Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
The example graph in Figure [[#fig:exa_undirected_graph|3]] has no Hamiltonian cycle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_H_cycle&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_H_cycle.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
However a slightly different graph in Figure [[#fig:exa_graph_H_cycle|8]] has a Hamiltonian cycle: (5,2,1,4,3,5).&lt;br /&gt;
&lt;br /&gt;
Hamiltonian cycle has applications in many fields including&lt;br /&gt;
&lt;br /&gt;
* computer science,&lt;br /&gt;
* logistics and&lt;br /&gt;
* network design.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Algorithms for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the next we give a brief description of the following two algorithms for finding Hamiltonian cycle:&lt;br /&gt;
&lt;br /&gt;
* Brute-force search and&lt;br /&gt;
* Backtracing algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Brute-force search - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search (also called exhaustive search) follows a naive approach and tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequences of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Backtracing algorithm - for finding Hamiltonian cycle&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of Backtracing algorithm is to add iteratively a new vertex to the actual path of subsequence of vertices, which is an adjacent to the last vertex of the actual path and not yet included in that path. After having the path with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices, it is checked whether it composes a cycle or not. If not then change the path by trying systematically all the adjacent vertices at every position in the path backwards, which is called backtracking.&lt;br /&gt;
&lt;br /&gt;
The algorithm can be implemented on elegant way by applying a recursive function call. The pseudo code of the algorithm is given in Algorithm 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 2 Backtracing algorithm - for finding Hamiltonian cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if Hamiltonian cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if Hamiltonian cycle exist&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]&amp;lt;/math&amp;gt;= first vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
3 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6   return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Recursive function&amp;lt;br /&amp;gt;&lt;br /&gt;
bool try_next_vertex_and_check_cycle(path_index k)&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: next index in the path (=sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
Output:&amp;lt;br /&amp;gt;&lt;br /&gt;
- true, if cycle found,&amp;lt;br /&amp;gt;&lt;br /&gt;
- false, if backtracking or cycle not exists&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k == |\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2   if exists edge between last and first vertices of path&amp;lt;br /&amp;gt;&lt;br /&gt;
3     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt; (cycle found)&amp;lt;br /&amp;gt;&lt;br /&gt;
4   else&amp;lt;br /&amp;gt;&lt;br /&gt;
5     return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;false&amp;lt;/math&amp;gt; (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v \in \mathcal{V}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is adjacent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k-1]&amp;lt;/math&amp;gt; (=last vertex in path)&amp;lt;br /&amp;gt;&lt;br /&gt;
9    and&amp;lt;br /&amp;gt;&lt;br /&gt;
10  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is not yet in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
11    path[k]=v&amp;lt;br /&amp;gt;&lt;br /&gt;
12    if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;try\_next\_vertex\_and\_check\_cycle(k+1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13      return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;true&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14    end&amp;lt;br /&amp;gt;&lt;br /&gt;
15    (Backtracking - remove v from path)&amp;lt;br /&amp;gt;&lt;br /&gt;
16    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[k] = -1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
17  end&amp;lt;br /&amp;gt;&lt;br /&gt;
18 end&amp;lt;br /&amp;gt;&lt;br /&gt;
19 return false (backtracking or cycle not exists)&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the course of backtracking every neighbours of every vertices can be tried by the algorithm. Therefore its computational complexity is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;chinese-postman-problem-route-inspection-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Chinese postman problem (Route inspection problem) ==&lt;br /&gt;
&lt;br /&gt;
The Chinese postman problem (also called as route inspection problem) is an extension of finding Eulerian cycle in connected and (unweighted or weighted) undirected graphs. The Chinese postman problem is to find shortest path that visits every edge of the connected and undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; at least once and return to the starting vertex. So the problem is defined on connected graph. The shortest path is defined as the one with minimum number of edges for unweighted graph and as the path with minimum accumulated weights for weighted graph. The solution path of Chinese postman problem is called Chinese postman tour. The Chinese postman problem can be solved in polynomial time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; contains an Eulerian cycle, then it is also the solution for the Chinese postman problem, since Eulerian cycle has the shortest path (minimum number of edges in unweighted graph and minimum accumulated weights in weighted graph) due to the necessity of visiting all edges at least once.&lt;br /&gt;
&lt;br /&gt;
Therefore the necessary and sufficient condition for the solution for the Chinese postman problem to be the Eulerian cycle is the existence of Eulerian cycle, which can be given as&lt;br /&gt;
&lt;br /&gt;
* Every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; have even degree.&lt;br /&gt;
&lt;br /&gt;
For example graph in Figure [[#fig:exa_graph_E-cycle|7]] the solution, i.e the Chinese postman tour is the Eulerian cycle, e.g. (1,3,5,6,7,5,4,3,2,1).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;solution-for-non-eulerian-graph&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solution for Non-Eulerian graph ===&lt;br /&gt;
&lt;br /&gt;
If the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; has no Eulerian cycle, then the graph must be extended to become Eulerian. This is done by duplicating some edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; connected to vertices with odd degree in order to change the degree of all these vertices become to even. The edges to be duplicated must be selected from the relevant ones (i.e. connected to vertices with odd degree) on that way, that the increase of the path length due to edge duplication must be the possible smallest. Therefore those pairing of the vertices with odd degree are selected, which have the shortest path connecting them.&lt;br /&gt;
&lt;br /&gt;
The example unweighted graph in Figure [[#fig:exa_graph_cpp_unweighted|9]] shows a Non-Eulerian graph and the Chinese postman tour obtained by duplicating the edges [2,4] and [3,1].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_unweighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_unweighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Similarly the example Non-Eulerian weighted graph in Figure [[#fig:exa_graph_cpp_weighted|10]] illustrates the construction of the Chinese postman by duplicating the edges [2,4], [4,6] and [5,1]. Here duplicating [2,4] together with [4,6] instead of [2,6] inserts shorter path (i.e. accumulated weight 2+1= 3 instead of 5). Similarly duplicating [5,1] instead of [5,3] together with [3,1] inserts shorter path (i.e. accumulated weight 1 instead of 1+2=3).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_cpp_weighted&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_cpp_weighted.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithm-for-chinese-postman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithm for Chinese postman problem ===&lt;br /&gt;
&lt;br /&gt;
Based on the above considerations the algorithm for finding the Chinese postman route can be given schematically by means of its steps in Algorithm 3.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 3 Algorithm for Chinese postman problem&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Chinese postman route.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 if grap &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; is Eulerian&amp;lt;br /&amp;gt;&lt;br /&gt;
2    Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    return Eulerian cycle and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 else&amp;lt;br /&amp;gt;&lt;br /&gt;
6    Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    Find all vertices with odd degree and store in array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;oddVertices&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Construct the complete graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt; from odd vertices together with edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt;representing shortest paths among any pairs of odd vertices&amp;lt;br /&amp;gt;&lt;br /&gt;
9    Find minimum weight perfect matching in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{C}&amp;lt;/math&amp;gt;, i.e the set of edges&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; reaching every odd vertices and together having smallest sum of weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; This set of edges is called minimum T-join.&amp;lt;br /&amp;gt;&lt;br /&gt;
10   Extend the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; by adding all edges from minimum T-join&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; resulting in extended graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
12   Find an Eulerian cycle in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
13   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt; = sum of all edge weights of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
14   return Eulerian cycle of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{H}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The numerical complexity of the above minimum T-join based algorithm for solving the Chinese postman problem is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, since both setting up the complete graph, and finding minimum weight perfect matching in it takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt; computational steps.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;minimum-spanning-tree---kruskals-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Minimum spanning tree - Kruskal’s algorithm ==&lt;br /&gt;
&lt;br /&gt;
A spanning tree of a graph is a tree including every vertices of the graph. The number of edges of a spanning tree is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt;, since the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|&amp;lt;/math&amp;gt;-th edge would introduce a cycle and it were not any more a tree.&lt;br /&gt;
&lt;br /&gt;
The minimum spanning tree (MST) is defined for a weighted, undirected, connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;, as a spanning tree with the minimal accumulated weights.&lt;br /&gt;
&lt;br /&gt;
Kruskal’s algorithm can be used to determine the MST of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. In the Kruskal’s algorithm all edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; are sorted according to their weights in increasing order. Then the algorithm iteratively adds the next edge from the sorted list, i.e. the edge with the smallest weight, together with their vertexes to MST, if the newly added edge does not induce a cycle. The algorithm proceeds until every edge on the list is checked. On this way the resulted graph will have &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|-1&amp;lt;/math&amp;gt; edge, so it will be a spanning tree and the way of constructing implies that it will have the least accumulated weights.&lt;br /&gt;
&lt;br /&gt;
The algorithm takes in each step the locally optimal decision due to adding the edge with the smallest weight among the still available ones. Therefore Kruskal’s algorithm is a greedy algorithm.&lt;br /&gt;
&lt;br /&gt;
The algorithm is shown schematically in Algorithm 4.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 4 Kruskal’s algorithm for detrmining MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: MST of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialise graph MST to be set empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Sort every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; in increasing weight order and insert them,&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; together with their vertexes into array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=0,\ldots size(sortedListEdges)-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    if inserting &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST does not induce a cycle&amp;lt;br /&amp;gt;&lt;br /&gt;
5      Add &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;sortedListEdges[v]&amp;lt;/math&amp;gt; into MST&amp;lt;br /&amp;gt;&lt;br /&gt;
6    end&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return MST&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt;, since sorting the edges has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; complexity, iterating through every edges and checking cycle has &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|) =\mathcal{O}(log(|\mathcal{E}|)&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{E}|&amp;lt;/math&amp;gt; is at most &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{V}|^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The memory need of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|+|\mathcal{E}|)&amp;lt;/math&amp;gt;, which is needed to store edges together with their vertexes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;traveling-salesman-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Traveling salesman problem ==&lt;br /&gt;
&lt;br /&gt;
The Traveling Salesman Problem (TSP) originates from a context of cities and given distances among them. TSP is to look for the shortest path that goes through each city exactly once and returns to the starting city. Usually there exists a route between any pair of cities with some given distance. In graph theory context an equivalent formulation of TSP can be given as looking for a path with the least accumulated weights in a weighted, often complete graph, that goes through each vertex exactly once and returns to the starting vertex. This is equivalent with finding the Hamiltonian cycle with the minimum accumulated weight in a weighted, often complete graph. Thus the TSP is more general than Hamilton cycle problem and hence Hamilton cycle problem is a special case of TSP. The resulted path can be also called as TSP path.&lt;br /&gt;
&lt;br /&gt;
The TSP was formulated mathematically in the 19th century and was first studied mathematically in the 1930s. The decision problem version of TSP is an NP-complete problem, so TSP is NP-hard. TSP is one of the most intensively investigated problem in combinatorial optimization, since it is used as benchmark for other optimization methods in terms of computational complexity.&lt;br /&gt;
&lt;br /&gt;
Some properties of TSP can be provided as&lt;br /&gt;
&lt;br /&gt;
* Symmetric and asymmetric TSP. In symmetric TSP the distance between two cities is the same in both direction, which leads to a formulation in graph theory context to a TSP on undirected graph. In asymmetric TSP either do not exist a path between two cities in both direction or the distances are different excluding the higher one from the TSP formulation. In these cases the formulation in graph theory context yileds a TSP on directed graph.&lt;br /&gt;
* Completing the graph by adding edges with sufficiently long distances will not affect the optimal path.&lt;br /&gt;
* The path to be a cycle or an open path does not make difference in the computational complexity of TSP (like in case of Hamilton path problem).&lt;br /&gt;
&lt;br /&gt;
The TSP has applications in numerous fields, like logistics, route planning in transport networks, manufacturing of microchips and DNA sequencing. One-way streets, airfares with different departure and arrival fees are real-world scenarios for applying asymmetric TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;generalizations-of-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Generalizations of TSP ===&lt;br /&gt;
&lt;br /&gt;
Several generalizations of TSP are listed below.&lt;br /&gt;
&lt;br /&gt;
* The travelling politician problem (also called as &amp;amp;quot;generalized travelling salesman problem&amp;amp;quot;) has a context with states having one or more cities and the travelling man must visit exactly one city from each state. It has been shown that travelling politician problem can be led back to standard TSP with modified distance matrix.&lt;br /&gt;
* The travelling purchaser problem has a purchaser, who has to buy a set of products, which can be bought in more cities but at different prices. The optimization objective is to find a path among a subset of cities that enables to buy all the products with minimal total cost (=taveling cost + purchasing cost).&lt;br /&gt;
* Vehicle routing problem.&lt;br /&gt;
* Ring star problem ([Labbé et al.(2004)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;integer-linear-programming-formulation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Integer linear programming formulation ===&lt;br /&gt;
&lt;br /&gt;
In order to form the TSP as Integer Linear Programming (ILP) optimization, several variables must be introduced. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; denote the number of cities (vertices), i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N = |\mathcal{V}|&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c_{ij}&amp;lt;/math&amp;gt; stand for the distances (weights) between the cities (vertices) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}&amp;lt;/math&amp;gt; be a decision variable describing whether the path goes from city (vertix) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, or not for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j = 1, \ldots, N&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;x_{ij} = \left\{&lt;br /&gt;
\begin{aligned}&lt;br /&gt;
1, \mathrm{\ \ } \mathrm{~if~path~goes~i \rightarrow j}  \\&lt;br /&gt;
0, \mathrm{\ \ } \mathrm{~otherwise~~~~~~~~~~~}&lt;br /&gt;
\end{aligned}&lt;br /&gt;
\right\}.&amp;lt;/math&amp;gt; The integer nature of the values &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; makes this optimization problem an ILP. The objective function of the optimization task is to minimize the path length (= accumulated weights), in other word&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij} ~j = 1, \ldots, N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However without further constraints this optimization considers not only paths, which are characterized by also leaving each reached vertex, but all set of edges enabling the minimum being at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i,j \in \mathcal{V}&amp;lt;/math&amp;gt;. Therefore further constraints are necessary to ensure that paths are considered and each vertex is visited exactly once. These requirements can be forced by formulating the following further two constraints, which force that the path reaches each vertex exactly once and leaves each vertex exactly once &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N, \\&lt;br /&gt;
\sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These constraints ensure that the selected way looks locally as path and all vertices are visited, but still allow that the selected set of edges comprises several local paths each of them visiting only a disjunct subset of vertices instead of one global path visiting every vertices. This global path requirement makes TSP a difficult problem. There are more ways to formulate this global path requirement as a linear constraint. The Miller-Tucker-Zemlin formulation introduces dummy variables &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; for keeping track the order of visit the city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 1, \ldots, N&amp;lt;/math&amp;gt;. The path starts with visiting city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. The global path requirement is ensured by forcing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; being higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; is visited before city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;, for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i = 2, \ldots, N&amp;lt;/math&amp;gt;. More precisely &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt; must be higher than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; at least by one when city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt; locates on the path after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;, and otherwise by a values less than &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; to ensure that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_{ij}=0&amp;lt;/math&amp;gt; does not force an unwanted relation between &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_j&amp;lt;/math&amp;gt;. Since city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is left out from these constraint, it ensures that the optimal path must return to city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;, otherwise the value of the dummy variable of the city visited after city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N-1&amp;lt;/math&amp;gt; would be less that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u_{N-1}&amp;lt;/math&amp;gt;, which would violate the constraint. The city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; is the only one for which a decrease in value of the dummy variable allowed when the path reaches city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. These considerations lead to the formulation of the global path requirement as a linear constraint as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Putting all these together gives the Miller-Tucker-Zemlin ILP formulation of the TSP as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\arg \min_{x_{ij}}  \sum_{i=1}^{N} \sum_{j=1,~j \neq i}^{N} c_{ij} x_{ij},~\ldots, N, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~subject~to} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}1.~~~ \sum_{i=1,~i \neq j}^{N} x_{ij} = 1, ~~ j = 1, \ldots, N,  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\&lt;br /&gt;
\mathrm{~constraint~}2.~~~ \sum_{j=1,~j \neq i}^{N} x_{ij} = 1, ~~ i = 1, \ldots, N,  \mathrm{~and~} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\ &lt;br /&gt;
\mathrm{~constraint~}3.~~~ u_i -u_j + 1 \leq (N-1)(1-x_{ij}) ~~ i,j \in \{2, \ldots, N \}  \mathrm{~and~} i \leq j.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;algorithms-for-tsp&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Algorithms for TSP ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Exact algorithm - Brute-force search&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brute-force search tries all the possible permutations of all the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices and selects the one with the lowest accumulated weights. This results in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|!&amp;lt;/math&amp;gt; different sequence of vertices the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|V|&amp;lt;/math&amp;gt; vertices, so the computational complexity of this algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|!)&amp;lt;/math&amp;gt;. Hence this approach becomes intractable already for number of cities in the magnitude of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;20&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Approximate algorithms&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Due to the NP-completeness of the TSP the exact solution becomes intractable very fast as the number of cities increases. Therefore there is a need for establishing approximate algorithms for the TSP.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Nearest neighbour algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Nearest Neighbour (NN) algorithm selects the nearest not yet visited neighbour city at each step. Thus its decision is locally optimal in each step, therefore it is a greedy algorithm. Its schematic representation is shown in Algorithm 5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 5 Nearest neighbour approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Hamiltonian cycle with minimum accumulated weights.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Determine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; from graph, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N =|\mathcal{V}|&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Initialize &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array, set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[0]=1&amp;lt;/math&amp;gt; and set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight = 0&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ }&amp;lt;/math&amp;gt; (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt; array =sequence of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; vertices)&amp;lt;br /&amp;gt;&lt;br /&gt;
3 for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v=1,\ldots N-1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4   Select nearest not yet visited city among neighbours of city &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v-1]&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path[v]=u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6   &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight += weight(path[v-1], u)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7 end&amp;lt;br /&amp;gt;&lt;br /&gt;
8 return &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;path&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;totalWeight&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the NN algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|)&amp;lt;/math&amp;gt;. For city arrangement distributed randomly on the plane, the NN algorithms gives a path which is only 25% longer than the shortest one. However for specific city arrangements the NN algorithm can produce also the worst route.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Christofides algorithm&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The heuristic approach of Christofides is based on using graph theoretical results to compose an approximate algorithm. It utilizes that a TSP path can not be longer than an Eulerian path over all cities of the graph. Therefore first a subgraph including all cities must be found, than it is extended to be an Eulerian graph, afterwards the Eulerian path is determined in the Eulerian graph and finally it is converted to a TSP path (i.e. to visit each city only once). If the minimum spanning tree of the original graph is selected as first graph and it is made to be an Eulerian graph by doubling every edge in it, then the total length of an Eulerian path can not be more than twice the one of the TSP path. Note that the length of the path changes also at converting the Eulerian path to a TSP path. During this step, shortcut is created for each city visited twice by inserting an edge from the city before this to a city after this. On this way one can approximate a solution for the TSP. The steps of the Christofides algorithm are shown schematically in Algorithm 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 6 Christofides approximate algorithm for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Duplicate every edges of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; to create an Eulerian graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find an Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{M}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Christofides algorithm was one of the first approximation algorithm, which shown that establishing an approximation algorithms can be practically usable approach for solving exactly intractable problems.&lt;br /&gt;
&lt;br /&gt;
An improved version of the algorithm is the algorithm of Christofides and Serdyukov, in whic a better way of creating an Eulerian graph is applied. This is done by applying the so called minimum weight matching. The steps of the algorithm of Christofides and Serdyukov can be seen schematically in Algorithm 7.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 7 Approximate algorithm of Christofides and Serdyukov for TSP&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Input: Undirected weighted graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Approximate TSP path.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Find a minimum spanning tree &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; of the graph.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Apply minimum weight matching to odd-degree vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{T}&amp;lt;/math&amp;gt; giving graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 Find optimal Eulerian path in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{W}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Convert Eulerian path to approximate TSP path by using shortcuts&amp;lt;br /&amp;gt;&lt;br /&gt;
5 return approximate TSP path&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Approximate algorithm of Christofides and Serdyukov gives an approximate TSP path with accumulated weights, which is at most 1,5 times higher than the one of the optimal TSP path. The computational complexity of the approximate algorithm of Christofides and Serdyukov is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{V}|^3)&amp;lt;/math&amp;gt;, which is mainly caused by minimum weight matching algorithm part.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;shortest-path-problem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Shortest path problem  ==&lt;br /&gt;
&lt;br /&gt;
The shortest path in a weighted graph between two vertices is the path connecting them with the smallest accumulated weight. There are more algorithm for finding shortest path, each with a slightly different applicability scope.&lt;br /&gt;
&lt;br /&gt;
Besides of Diskstra’s algoritm another common algorithms are the [https://en.wikipedia.org/wiki/Bellman-Ford_algorithm Bellman-Ford] and the [https://en.wikipedia.org/wiki/Floyd-Warshall_algorithm Floyd Warshall] algorithms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;dijkstra-algorithmus&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Dijkstra-Algorithmus ===&lt;br /&gt;
&lt;br /&gt;
Diskstra’s algorithm finds the shortest path from a given source vertex to every vertices in a weighted graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;. The graph must not contain negative edge, since in that case the algorithm fails.&lt;br /&gt;
&lt;br /&gt;
The idea of Diskstra’s algorithm is an iterative extension of shortest path tree (SPT) containing a subtree with vertices, for which the shortest paths from the a given source have already been found. The vertices outside of SPT have also minimum distance values assigned during the intermediate steps of the processing. The minimum distance values of vertices being neighbour of any vertices of SPT and locating outside of SPT represent the minimum distance from source vertex to the considered vertex via every possible routes over the vertices of the actual SPT. The iterative extension of SPT is performed by selecting the vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with the shortest minimum distance among the vertices locating outside of SPT, adding this vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; together with its minimum distance to SPT and reevaluating the minimum distances of each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; locating outside of the updated SPT and being the neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;. During the reevaluation the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; is compared to the sum (minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)) and if the later is smaller then the minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; will be updated.&lt;br /&gt;
&lt;br /&gt;
The schematical representation of the algorithm can be seen in Algorithm 8.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm 8 Dijkstra-Algorithmus for determining SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Inputs:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Undirected weighted connected graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
- Source vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Output: Array of minimum distances to every vertices &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Create an adjacenty matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; for maintaining SPT with vertices (subtree),&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;for which the shortest paths from the a given source have already been found&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and initialize it to empty.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt; stores already found minimum distance values for its vertices.&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Create and adjacency matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; for representing the graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being a&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;subgraph of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{G}&amp;lt;/math&amp;gt; containing vertices locating outside of SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;and every edges of them. Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; stores also actual values of&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;minimum distance to every vertices of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;Initialize all these distance values to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt;, and for the source vertex&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ }&amp;lt;/math&amp;gt;set the minimum distance to the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
3 while matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; is not empty (=not all vertices are moved from it)&amp;lt;br /&amp;gt;&lt;br /&gt;
4    take a vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt; with the smallest minimum distance&amp;lt;br /&amp;gt;&lt;br /&gt;
5    add vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; with its minimum distance and its edge connecting it to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
6     matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7      for each vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; of graph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; being neighbour of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8        (update minimum distance of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; in matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;: )&amp;lt;br /&amp;gt;&lt;br /&gt;
9        if minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;) &amp;amp;lt; minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
10         minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; = minimum distance of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; + weight of (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt;- &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
11         mark edge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; as edge connecting to SPT&amp;lt;br /&amp;gt;&lt;br /&gt;
12       end&amp;lt;br /&amp;gt;&lt;br /&gt;
13     end&amp;lt;br /&amp;gt;&lt;br /&gt;
14     remove the row of vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
15      (that means also removing vertex &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;u&amp;lt;/math&amp;gt; from subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
16 end&amp;lt;br /&amp;gt;&lt;br /&gt;
17 Build up array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt; from SPT matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
18 return array &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;minDist[]&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The computational complexity of the algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{V}|))&amp;lt;/math&amp;gt;, since finding the vertex in the subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; takes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))&amp;lt;/math&amp;gt; operations, which must be done for every vertices. Note that it is the same as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{E}|*log(|\mathcal{E}|))&amp;lt;/math&amp;gt; due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(log(|\mathcal{V}|))= \mathcal{O}(log(|\mathcal{E}|))&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The finding the vertex of subgraph &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\boldsymbol{R}&amp;lt;/math&amp;gt; with the smallest minimum distance can be implemented by the help of priority queue (or Heap). The standard usage of priority queue would overwrite minimum distance in the inserted pair (minimum distance - vertex) for the same vertex always by the minimum distance of the lastly checked edge to that vertex, which is not necessarily the smallest one among every edges. This can be resolved by inserting more copies of the pair (minimum distance - vertex) for the same vertex, since priority queue will take only the one of them with the smallest value of minimum distance.&lt;br /&gt;
&lt;br /&gt;
Dijkstra’s algorithm assumes that in each intermediate step, the minimum distances of the vertices in SPT, are already the final ones, i.e. the shortest paths from the a given source to the vertices of SPT have already been found. This holds with non- negative weight, since in this case a new path to a vertex in SPT via any vertices of outside of SPT would increase the distance by a sum of non-negative weights which then can not be smaller then the distance marked in SPT as the minimum one. However this is not true in case of existence of negative weight, and thus for graphs with negative weights Dijkstra’s algorithm can return higher distance than than the real minimal one, i.e. wrong result. This is illustrated on the graph in Figure [[#fig:exa_graph_neg_weight|11]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:exa_graph_neg_weight&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/exa_graph_neg_weight]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
For this graph Dijkstra’s algorithm would give minimum distance for node &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; the value &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;4&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;6&amp;lt;/math&amp;gt;, which is wrong, since the right value is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;3&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;5&amp;lt;/math&amp;gt;, respectively&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Number_Theory&amp;diff=6517</id>
		<title>Number Theory</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Number_Theory&amp;diff=6517"/>
		<updated>2025-03-04T22:10:31Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;number-theory-and-its-application-to-cryptography-combinatorics-relations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Number Theory and its Application to Cryptography, Combinatorics, Relations =  For a comprehensive subject on number theory the reader is referred to the book [Hardy and Wright(1975)].  &amp;lt;span id=&amp;quot;elementary-number-theory&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Elementary number theory ==  &amp;lt;span id=&amp;quot;prime-factorisation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; === Prime factorisation ===  &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\m…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;number-theory-and-its-application-to-cryptography-combinatorics-relations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Number Theory and its Application to Cryptography, Combinatorics, Relations =&lt;br /&gt;
&lt;br /&gt;
For a comprehensive subject on number theory the reader is referred to the book [Hardy and Wright(1975)].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elementary-number-theory&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Elementary number theory ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;prime-factorisation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Prime factorisation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fundamental theorem of arithmetic&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Fundamental theorem of arithmetic - in number theory&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Every integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a &amp;gt; 1&amp;lt;/math&amp;gt; is either prime itself or the product of prime numbers, where this product is unique, up to the order of the factors. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a= \prod_{i=1}^{n} p_i^{e_i}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_i&amp;lt;/math&amp;gt; is the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th prime number arising in the product generating &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i&amp;lt;/math&amp;gt; is its multiplicity.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Prime factorisation algorithm&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The prime factorisation is an iterative algorithm to determine the prime factors of a given number. The algorithm is based on the Fundamental theorem of arithmetic. The prime factors are determined by performing iterative division by prime numbers in increasing order.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; Prime factorisation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;2520&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
2520 | 2&amp;amp; \\&lt;br /&gt;
1260 | 2&amp;amp; \\&lt;br /&gt;
630 | 2&amp;amp; \\   &lt;br /&gt;
315 | 3&amp;amp; \\&lt;br /&gt;
105 | 3&amp;amp; \\&lt;br /&gt;
35 | 5&amp;amp; \\&lt;br /&gt;
7 | 7&amp;amp; \\&lt;br /&gt;
1 | \mathrm{\ }&amp;amp; \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prime factorisation is believed to be difficult to perform practically for large number since its time complexity is NP, i.e. superpolynomial (= not bounded above by any polynomial).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;congruence&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Congruence ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modulo operator&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - modulo operator&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod  m =&amp;lt;/math&amp;gt; the remainder after dividing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
It follows &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a \mod  m = r \equiv a = k*m +r, \mathrm{~where~} 0 &amp;lt;= r &amp;lt; m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Operator identities of modulo operator are given as&lt;br /&gt;
&lt;br /&gt;
# Distributivity - addition &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a+b) \mod  n = [(a \mod  n) + (b \mod  n)] \mod  n&amp;lt;/math&amp;gt;&lt;br /&gt;
# Distributivity - multiplication &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ab \mod  n = [(a \mod  n)*(b \mod  n)] \mod  n&amp;lt;/math&amp;gt;&lt;br /&gt;
# Distributivity - power &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^c \mod  m = (a \mod  m)^c  \mod  m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These identities can be proved directly from the definition of the modulo operator. Due to these three identities one can think in modular arithmetic including only addition, multiplication and power, like in regular integer arithmetic without modulo.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Greatest common divisor&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Divisability&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - divisability&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is dividable by a if and only if there exists an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n = a*k&amp;lt;/math&amp;gt;. This is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a|n&amp;lt;/math&amp;gt;. The number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is called the divisor of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Greatest common divisor operator&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - greatest common divisor, gcd() operator&amp;lt;/u&amp;gt; The greatest common division of the integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd(a,b)&amp;lt;/math&amp;gt; is defined by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;gcd(a,b) = \max_i \{d_i \mathrm{~such~that~} d_i|a \mathrm{~and~} d_i|b\}.&amp;lt;/math&amp;gt; An alternative notation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd(a,b)&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The operator characteristics of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd()&amp;lt;/math&amp;gt; operator are given by&lt;br /&gt;
&lt;br /&gt;
# Reflexivity: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,b) = (b,a).&amp;lt;/math&amp;gt;&lt;br /&gt;
# &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; is neutral element with respect to the operator &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;gcd()&amp;lt;/math&amp;gt;. In other words &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,0) = a.&amp;lt;/math&amp;gt;&lt;br /&gt;
# The following relation holds &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(a,b)=(b, a \mod  b).&amp;lt;/math&amp;gt; Proof.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = d \Rightarrow a=de, b=df \mathrm{~and~} (e,f)=1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Let &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e=gf+h&amp;lt;/math&amp;gt; be, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h &amp;lt;f&amp;lt;/math&amp;gt;. It follows that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h) =1&amp;lt;/math&amp;gt;, since otherwise &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f&amp;lt;/math&amp;gt; and due to expression of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; also &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; were dividable by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h)&amp;lt;/math&amp;gt; which would lead to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(e,f)&amp;gt;1&amp;lt;/math&amp;gt;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a=de=dgf+dh=gb+dh \Rightarrow a \mod  b = dh \mod  df=dh&amp;lt;/math&amp;gt;, where the last step comes from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h&amp;lt;f&amp;lt;/math&amp;gt;. Thus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(b, a \mod  b) = (b,dh)=(df,dh) = d&amp;lt;/math&amp;gt;, due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(f,h) =1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Congruence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - relatively prime (also called as coprime)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; are relatively prime if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)=1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - congruence&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The congruence is a relation and refers to a base number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. The integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; are in congruence relation if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a\mod m) = (b\mod m)&amp;lt;/math&amp;gt; . The congruence id denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b\mod m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b\mod m&amp;lt;/math&amp;gt; implies &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m|(b-a)&amp;lt;/math&amp;gt;. Congruence is an equivalence relation - partitioning the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; disjunct subsets.&lt;br /&gt;
&lt;br /&gt;
Being an equivalence relation, congruence have the following properties: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\mathrm{CP1.~}\mathrm{~ reflexivity~} a \equiv a\mod  m\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}  \\&lt;br /&gt;
&amp;amp;\mathrm{CP2.~}\mathrm{~ symmetry~}a \equiv b \mod~m \Rightarrow b \equiv a\mod m\\&lt;br /&gt;
&amp;amp;\mathrm{CP3.~}\mathrm{~ transitivity~} a \equiv b\mod m \mathrm{~ and~} b \equiv c\mod m \Rightarrow a \equiv c\mod m \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operator identities of the congruence refer to given &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \equiv b \mod  m&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c \equiv d \mod  m&amp;lt;/math&amp;gt; and can be given as&amp;lt;br /&amp;gt;&lt;br /&gt;
CO1. Adding a constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a + \alpha \equiv b + \alpha \mod  m.&amp;lt;/math&amp;gt; CO2. Multiplication by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\alpha*a \equiv \alpha*b \mod  m.\\&lt;br /&gt;
    &amp;amp;\Rightarrow -a \equiv -b \mod  m.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; CO3. Addition of congruences &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a+c \equiv b+d \mod  m.&amp;lt;/math&amp;gt; CO4. Multiplication of congruences &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a*c \equiv b*d \mod  m.&amp;lt;/math&amp;gt; CO5. Division by constant &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\alpha*a \equiv \alpha*b \mod  m \Rightarrow a \equiv b \mod  m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first three identities can be proved directly from the definitions of the modulo and congruence operators. The last identity follows from the general identity for division by constant: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\alpha*a \equiv \alpha*b \mod  m \Leftrightarrow a \equiv b \mod  (m/d),&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\alpha, m) = d&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;\alpha*a \equiv \alpha*b \mod  m \Leftrightarrow  m|[\alpha*(b-a)]\Leftrightarrow \\&lt;br /&gt;
&amp;amp;[m/d]|[\alpha/d*(b-a)] \Leftrightarrow  [m/d]|[(b-a)],&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(m/d,\alpha/d)=1&amp;lt;/math&amp;gt;. Then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[m/d]|[(b-a)] \Leftrightarrow  a \equiv b \mod  (m/d)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Congruence class&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; (also called residue class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is any of the disjunct subsets resulted by partitioning the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}&amp;lt;/math&amp;gt; by congruence as equivalence relation. In other words congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is a set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{k \in Z \mathrm{~such~that~} k \equiv a \mod m}&amp;lt;/math&amp;gt; for any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a =0,\ldots, (m-1)&amp;lt;/math&amp;gt;. For a specific &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; the congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a + m \mathbb{Z}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The set of all congruence classes modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbb{Z}/m\mathbb{Z}&amp;lt;/math&amp;gt;. Thus the number of elements in this set is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, and this set can be given as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathbb{Z}/m\mathbb{Z} = \{0+m\mathbb{Z}, 1+m\mathbb{Z},..., (m-1)+m\mathbb{Z}\}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The set of congruence classes relative prime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;. For any &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; representing an element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; holds &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m) = 1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;(\mathbb{Z}/10\mathbb{Z})^* = \{1+10\mathbb{Z}, 3+10\mathbb{Z}, 7+10\mathbb{Z}, 9+10\mathbb{Z}\}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If m is prime then number of elements in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; = &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;diophantic-equations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Diophantic equations ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;euclidean-algorithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Euclidean algorithm ===&lt;br /&gt;
&lt;br /&gt;
The Euclidean algorithm is the standard way of solving the equation of the form &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by=(a,b),&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a,b,x,y \in \mathbb{Z}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Theoretic basics&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Bézout’s identity&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The greatest common divisor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; of two integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; can be represented as a linear sum of the original two numbers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\exists x,y \in \mathbb{Z},  \mathrm{~for~which~} g = (a,b)=ax+by.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Theorem&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The set of all integer linear combinations of the nonzero integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; equals the set of integer muliples of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;, i.e: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a\mathbb{Z}+b\mathbb{Z}=(a,b)\mathbb{Z},&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proof:&lt;br /&gt;
&lt;br /&gt;
* Step 1: direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a\mathbb{Z}+b\mathbb{Z} \in (a,b)\mathbb{Z}&amp;lt;/math&amp;gt; - follows from definition of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 2: direction &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)\mathbb{Z} \in a\mathbb{Z}+b\mathbb{Z}&amp;lt;/math&amp;gt; - follows from Bézout’s identity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)=ax+by, \mathrm{~where~} x,y \in \mathbb{Z} \Rightarrow (a,b)\mathbb{Z} = ax\mathbb{Z}+by\mathbb{Z}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary 1&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = n, \mathrm{~where~} a,b,x,y,n \in \mathbb{Z} \mathrm{~and~} a\neq 0, b\neq 0&amp;lt;/math&amp;gt; has a solution if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)|n&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: It follows directly from the above theorem.&amp;lt;br /&amp;gt;&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Case 1: If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = 1&amp;lt;/math&amp;gt; then the equation has always a solution.&lt;br /&gt;
* Case 2: If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = d \neq 1&amp;lt;/math&amp;gt; then this case can be fallbacked to Case 1: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;a=de, b=df \mathrm{~and~} (e,f) = 1~(\mathrm{otherwise~} (a,b) &amp;gt; d)\\&lt;br /&gt;
    &amp;amp;dex+dfy=dg,  \mathrm{~then~dividing~by~}d\\&lt;br /&gt;
    &amp;amp;ex+fy=g,  \mathrm{~where~} (e,f) = 1.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary 2&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = (a,b),  \mathrm{~where~} a,b,x,y \in \mathbb{Z}\mathrm{~and~}a\neq0, b\neq0&amp;lt;/math&amp;gt; has always a solution.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: It follows directly from Corollary 1.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Solution of equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax+by = (a,b)&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The solution of the equation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax+by = (a,b)&amp;lt;/math&amp;gt; consists of two steps as&lt;br /&gt;
&lt;br /&gt;
# determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt; - by means of base variant of Euclidean algorithms and&lt;br /&gt;
# determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; - by means of the extended variant of the algorithm.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Euclidean algorithm - base variant&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea of the base variant of Euclidean algorithms is the recursive application of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b) = (b, a \mod b)&amp;lt;/math&amp;gt; until &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(h,0) = h&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,b)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;455x + 135y = (455,135)\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;455 = 3*135 + 50\\&lt;br /&gt;
&amp;amp;135 = 2*50 + 35\\&lt;br /&gt;
&amp;amp;50 = 1*35 + 15\\&lt;br /&gt;
&amp;amp;35 = 2*15 + 5\\&lt;br /&gt;
&amp;amp;15 = 3* 5 + 0\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;\Rightarrow (455,135) = 5\\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Pseudo code of determination gcd(a,b) (as well as storing the coefficients q[i]-s) by means of the base variant of the Euclidean algorithm can be given as&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;h = a;  \mathrm{~the~higher~value~} \\&lt;br /&gt;
&amp;amp;s = b    \mathrm{~the~smaller~value~} \\&lt;br /&gt;
&amp;amp;i = 0; \\&lt;br /&gt;
&amp;amp;while (s &amp;gt; 0)    \mathrm{~until~} s \mathrm{~reaches ~} 0 \\&lt;br /&gt;
&amp;amp;\{ \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }q[i++] = h \div s; \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }t = s; \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }s = h \% s; \mathrm{~next~} s \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ }h = t;    \mathrm{~next~} h \\&lt;br /&gt;
&amp;amp;\} \\&lt;br /&gt;
&amp;amp;n = i-1; \\&lt;br /&gt;
&amp;amp;gcd = h; \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Euclidean algorithm - extended variant&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The extended Euclidean algorithm is used to determine the unknowns &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt; after carrying out the base variant of the Euclidean algorithm. This is a necessary previous step, since the extended Euclidean algorithm uses the quotient and remainders computed in the course of executing the steps of the base variant of Euclidean algorithms. The idea of extended Euclidean algorithm is a recursive application of backward substitution based on the steps of the base variant of Euclidean algorithms. This is shown in the next example.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - determination of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;455x + 135y = 5 \\&lt;br /&gt;
&amp;amp; \\&lt;br /&gt;
&amp;amp; \mathrm{~Starting~with~last~but~one~line~of~the~solution~by~the~base~variant~we~get~} \\ &lt;br /&gt;
5 &amp;amp;= 35 - 2*15 = \\&lt;br /&gt;
&amp;amp;= 35 - 2*(50 - 1*35) = -2*50 + 3*35 = \\&lt;br /&gt;
&amp;amp;= -2*50 + 3*(135 - 2*50) = 3*135 - 8*50 = \\&lt;br /&gt;
&amp;amp;= 3*135 - 8*(455 - 3*135) = -8*455 + 27*135&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;\Rightarrow  x=-8, y=27 &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; The time complexity&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The time complexity of both the base and extended variant of Euclidean algorithm is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O((\log h)^2)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;h&amp;lt;/math&amp;gt; is the number of digits in the smaller number among &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;fermateuler-theorem-and-little-fermat-theorem&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Fermat–Euler theorem and little Fermat theorem) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Euler’s phi function&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Euler’s phi function, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;, also called as Euler’s totient function, is defined as the number of integers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; in the range &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 \leq k \leq n&amp;lt;/math&amp;gt;, for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively primes. In other words&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\phi(n) = |{1&amp;lt;=k&amp;lt;=n  \mathrm{~such~that~} (k,n)=1}|,&amp;lt;/math&amp;gt; where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A|&amp;lt;/math&amp;gt; stands for the cardinality of the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;. Note that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; never includes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, since&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n,n) = n \neq 1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\Rightarrow  \phi(n) &amp;lt;= n-1.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - Computation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(10)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\{{1&amp;lt;=k&amp;lt;=10  \mathrm{~such~that~} (k,10)=1}\} = \{1,3,7,9\} \\&lt;br /&gt;
    &amp;amp;\Rightarrow  \phi(10) = |{1,3,7,9}| = 4.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The properties of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; can be given as&lt;br /&gt;
&lt;br /&gt;
# If p is prime then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(p) = p-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If (m,n)=1 then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m*n)=\phi(m)*\phi(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
# If p and q are prime then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(p*q) = (p-1)*(q-1)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof. This property follows from properties 2. and 1.&lt;br /&gt;
# In general &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt; can be expressed by the prime factorisation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n) = n*\prod_{i=1}^{k} (1-1/p_i)&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=\prod_{i=1}^{k}p_i^{e_i}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The order of congruence classes relative prime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; is exactly &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;. If m prime then this order is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fermat–Euler theorem&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Fermat–Euler theorem - also called as Euler’s theorem&amp;lt;/u&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively prime then&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{\phi(n)} \equiv 1 \mod n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Fermat’s little theorem&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Fermat’s little theorem&amp;lt;/u&amp;gt; - If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is prime and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; are relatively prime then &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{p-1} \equiv 1 \mod n.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fermat’s little theorem is a special case Fermat–Euler theorem for the case where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; is prime.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modular-multiplicative-inverse-and-its-computation&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modular multiplicative inverse and its computation ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Residue systems modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Complete system of residues modulo m&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is any set of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; integers so that each element comes from a different congruence class modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is the set &amp;lt;span&amp;gt;0,1,..., m-1&amp;lt;/span&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Reduced residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Reduced residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is a set obtained from complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; by deleting all elements being not coprime with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modular multiplicative inverse of an integer&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;, is the integer x that is given by &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax \equiv 1 \mod m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe, that not every elements of a complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse !&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Theorem&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
An integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; element of complete system of residues modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse if and only if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; are relatively prime, in other words if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m) = 1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;ax \equiv 1 \mod m \Leftrightarrow ax + bm = 1\\&lt;br /&gt;
    &amp;amp;\mathrm{~The~equation~} ax + my = 1 \mathrm{~has~solution~if~and~only~if~} (a,m) = 1.&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The modular multiplicative inverse of integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is denoted by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{-1}&amp;lt;/math&amp;gt;. This can be explained by dividing the relation the relation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax \equiv 1 \mod m&amp;lt;/math&amp;gt; formally by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt;. With this notation holds the relation &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{-1} \equiv x \mod m  \Leftrightarrow ax \equiv 1 \mod m.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If exists, the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is determined uniquely&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Corollary&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
If &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is prime then each of the elements &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{1,..., m-1}&amp;lt;/math&amp;gt; of the least residue system modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; has modular multiplicative inverse.&amp;lt;br /&amp;gt;&lt;br /&gt;
Proof: Each element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{1,..., m-1}&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; are relatively primes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Computation of the modular multiplicative inverse&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m, (a,m)=1&amp;lt;/math&amp;gt; can be computed on the following ways.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Computation way 1. - by using the extended Euclidean algorithm &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;ax \equiv 1 \mod m \Leftrightarrow ax + bm = 1.&amp;lt;/math&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Due to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m)=1&amp;lt;/math&amp;gt; the equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax + bm = 1&amp;lt;/math&amp;gt; has solution. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Solving the equation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ax + bm = 1&amp;lt;/math&amp;gt; by the extended Euclidean algorithm, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; gives the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m&amp;lt;/math&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Computation way 2. - by means of efficient computation of raising an integer to a higher power, using a formula based on Euler’s theorem &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;a^{\phi(n)-1}*a \equiv 1 \mod n \Rightarrow a^{-1} \equiv a^{\phi(n)-1} \mod n&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The the modular multiplicative inverse of an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \mod m&amp;lt;/math&amp;gt; are given by &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{\phi(n)-1} \mod n&amp;lt;/math&amp;gt;, which can be determined by efficient computation of a modular multiplicative inverse - by using exponentiation by squaring.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Modular exponentiation by squaring&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Modular exponentiation is raising an integer to a higher power modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, in other words computing &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e \mod n&amp;lt;/math&amp;gt;. Exponentiation by squaring is an efficient computation of modular exponentiation. The idea of exponentiation by squaring is to compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e \mod n&amp;lt;/math&amp;gt; by the help of successive squares of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt;. This can be implemented as follows.&lt;br /&gt;
&lt;br /&gt;
* Rearrange &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^e&amp;lt;/math&amp;gt; by using the binary representation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g^e = g^{(\sum_{i=0}^{k}e_i*2^i)} = \prod_{i=0}^{k} g^{e_i*2^i}.&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Only those terms of the product must be computed, for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=1&amp;lt;/math&amp;gt;, since for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=0&amp;lt;/math&amp;gt; the term &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{e_i*2^i}&amp;lt;/math&amp;gt; becomes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{0*2^i}=1&amp;lt;/math&amp;gt;. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The terms with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e_i=1&amp;lt;/math&amp;gt; becomes powers of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{2^i}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Computation of the powers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^{2^i}&amp;lt;/math&amp;gt; successively by applying &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;g^{2^{l+1}} = (g^{2^l})^2  \mathrm{~for~} l&amp;gt;=0&amp;lt;/math&amp;gt;&lt;br /&gt;
* Computate each term with mod &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - Exponentiation by squaring&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;3^{52} \mod 100 \\&lt;br /&gt;
&amp;amp; \\&lt;br /&gt;
&amp;amp;52 = 110100 = 2^2+2^4+2^5 \\&lt;br /&gt;
&amp;amp;3^{(2^0)} = 3\\&lt;br /&gt;
&amp;amp;3^{(2^1)} = 3^2 = 9\\&lt;br /&gt;
&amp;amp;3^{(2^2)} = 9^2 = 81\\&lt;br /&gt;
&amp;amp;3^{(2^3)} = 81^2 \mod 100 = 61\\&lt;br /&gt;
&amp;amp;3^{(2^4)} = 61^2 \mod 100 = 21\\&lt;br /&gt;
&amp;amp;3^{(2^5)} = 21^2 \mod 100 = 41\\&lt;br /&gt;
&amp;amp;\\&lt;br /&gt;
&amp;amp;3^{52} \mod 100 = 81*21*41 \mod 100 = 41.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; Conclude that instead of 52 multiplications only 5 squaring and 3 multiplications were needed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;discrete-logarithm&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discrete logarithm ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Primitive root modulo m&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; if for every integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; being coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; (i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(a,m)=1&amp;lt;/math&amp;gt;) there is an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; for which &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g^k \equiv a \mod n&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Interpretation&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
All elements of the set of congruence classes coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; can be generated by power of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. Therefore&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is also called as generator of the set of congruence classes coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; and&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; must be coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is the lowest power of a which is congruent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Statement&amp;lt;/u&amp;gt; The multiplicative order of primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
This is because&lt;br /&gt;
&lt;br /&gt;
* this power of a is congruent to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt;, since &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a^{\phi(m)} \equiv 1 \mod n&amp;lt;/math&amp;gt; due to Euler’s theorem and&lt;br /&gt;
* this is the lowest power as the other lower powers are needed to generate the other elements of the set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It follows that if &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; is prime then the multiplicative order &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m) = m-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note that not all elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; are primitive root modulo m ! However the non-primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; elements are cyclic generator of a subset of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;. The non-primitive root elements of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt; have also multiplicative order, which is can be however less then &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(m)&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;Example&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m=7&amp;lt;/math&amp;gt; prime &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;(\mathbb{Z}/7\mathbb{Z})^* - \mathrm{~least~residue~system~modulo~} 7 = {0,1,..., 6}\mathrm{~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}\\&lt;br /&gt;
&amp;amp;\mathrm{~~The~elements~} 3 \mathrm{~and~} 4 \mathrm{~are~primitive~root~modulo~} m. \\&lt;br /&gt;
&amp;amp;\mathrm{~~For~example~the~element~} 2 \mathrm{~is~not~primitive~root~modulo~} m!\\&lt;br /&gt;
&amp;amp;\mathrm{~~}\Rightarrow \mathrm{~~Multiplicative~order~of~} 2 \mathrm{~is~} 3 &amp;lt; \phi(7)=6, \mathrm{~since~} 2^3 \equiv 1 \mod 7. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Discrete logarithm to the base &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Definition - Discrete logarithm (also called index)&amp;lt;/u&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Discrete logarithm, also called index When &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a=g^k \equiv a \mod m&amp;lt;/math&amp;gt; then the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; is called as discrete logarithm of the integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; to the base &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;. Here &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; is primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; is an element of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(\mathbb{Z}/m\mathbb{Z})^*&amp;lt;/math&amp;gt;, i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The practical importance of the discrete logarithm lies in its property that computation of discrete logarithm is believed to be difficult to perform, especially for some specific groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;application-to-cryptography&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Application to cryptography ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; RSA cryptography&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RSA is a cryptosystem, called after its developers: Rivest, Shamir and Adleman. The principle of the key generation can be described by means of the following steps.&lt;br /&gt;
&lt;br /&gt;
* Step 1. Select large primes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt;, e.g. each of them with size &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;512&amp;lt;/math&amp;gt; bits.&lt;br /&gt;
* Step 2. Compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n=p*q&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 3. Compute &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)= (p-1)*(q-1)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 4. Select a random integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; e &amp;lt; \phi(n)&amp;lt;/math&amp;gt;, such that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt; is coprime to &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi(n)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Step 5. Determine an integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; d &amp;lt; \phi(n)&amp;lt;/math&amp;gt;, such that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e*d \mod \phi(n) = 1&amp;lt;/math&amp;gt;, i.e. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; is modular multiplicative inverse of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;e&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; The integer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; can be computed&lt;br /&gt;
** either by using the extended Euclidean algorithm&lt;br /&gt;
** or by the help of Euler’s theorem and using exponentiation by squaring.&lt;br /&gt;
&lt;br /&gt;
The keys are called as&lt;br /&gt;
&lt;br /&gt;
* private key = d&lt;br /&gt;
* public keys = e, n&lt;br /&gt;
&lt;br /&gt;
Secret parameters of the key generation: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p, q, \phi(n)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The usage of RSA for encryption can be explained as&lt;br /&gt;
&lt;br /&gt;
* Notation: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;lt;/math&amp;gt; = message, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; = chipertext - both in form natural numbers&lt;br /&gt;
* Condition: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m &amp;lt; n&amp;lt;/math&amp;gt; - needed for the correct decryption, see below.&lt;br /&gt;
* The encryption end decryption processes&lt;br /&gt;
** The encryption &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c = m^e \mod n,&amp;lt;/math&amp;gt;&lt;br /&gt;
** The decryption &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;m&amp;#039; = c^d \mod n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The correctness of the RSA cryptographic algorithm can be shows by showing &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;m&amp;#039;=m&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Proof: Using the way of generation of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; we have &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;e*d \mod \phi(n) = 1 \Rightarrow e*d = 1 + k*\phi(n)&amp;lt;/math&amp;gt; By using it, the decrypted chipertext &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;m&amp;#039;&amp;lt;/math&amp;gt; can be rearranged as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
m&amp;#039; &amp;amp;= c^d\mod n = (m^e)^d\mod n = m^{e*d}\mod n  = m^{1 + k*\phi(n)}\mod n =\\&lt;br /&gt;
&amp;amp;= [(m^1\mod n) * ((m^{\phi(n)})^k\mod n)]\mod n = \\&lt;br /&gt;
&amp;amp; \mathrm{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow  \mathrm{~condition~} m &amp;lt; n \\&lt;br /&gt;
&amp;amp;= [m * ((m^{\phi(n)} \mod n)^k) \mod n] \mod n = \\&lt;br /&gt;
&amp;amp;\mathrm{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow \mathrm{~Euler&amp;#039;s~theorem~}\\&lt;br /&gt;
&amp;amp;= (m * 1) \mod n = m \\&lt;br /&gt;
&amp;amp;\mathrm{\  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \uparrow \mathrm{~condition~} m &amp;lt; n. &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, that proof of correctness is also possible by using Fermat’s little theorem utilizing the fact that &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n = p*q&amp;lt;/math&amp;gt;, i.e. multiplication of two primes.&lt;br /&gt;
&lt;br /&gt;
RSA can be used both for&lt;br /&gt;
&lt;br /&gt;
* encryption and&lt;br /&gt;
* authentication,&lt;br /&gt;
&lt;br /&gt;
in both cases including key distribution. Proof of correctness for using RSA for authentication can be shown similar to that one provided for the case of using it for encryption.&lt;br /&gt;
&lt;br /&gt;
The secrecy of RSA is based on the computational difficulty of prime factorization.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; If n could be factorized on efficient way then the secrecy of RSA would be broken !!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Diffie–Hellman key exchange&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Diffie–Hellman key exchange is a protocol for secure key distribution. The principle of the solution is to generate the common secret key without exchanging the key itself. This is achieved on the way that each party shares only a partial info on the key to be generated.&lt;br /&gt;
&lt;br /&gt;
The Diffie-Hellman key establishment protocol can be described by the following steps.&lt;br /&gt;
&lt;br /&gt;
* Step 1. The parties A and B agree on a prime &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and a natural number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; g &amp;lt; p&amp;lt;/math&amp;gt;, which is a primitive root modulo &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Step 2. Each party selects a secret number &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha &amp;lt; p-1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta &amp;lt; p-1&amp;lt;/math&amp;gt;, and computes the power &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = g^{\alpha} \mod p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b = g^{\beta} \mod p&amp;lt;/math&amp;gt;, respectively.&lt;br /&gt;
* Step 3. Each party sends &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; to the other party.&lt;br /&gt;
* Each party computes the common secret key &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; based on the received numbers &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k =a^{\beta} \mod p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k = b^{\alpha} \mod p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Keys arising in the key exchange protocol are classified as&lt;br /&gt;
&lt;br /&gt;
* Public keys: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p, g, a&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;&lt;br /&gt;
* Private keys: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The operation way of the Diffie-Hellman key exchange protocol is shown in Figure [[#fig:Diffie-Hellman_ke|1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:Diffie-Hellman_ke&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:./figs/Diffie-Hellman_key_exchange.pdf]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
The equality of the keys generated on the different sides can be shown as follows. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
a^{\beta} \mod p &amp;amp;= (g^{\alpha})^{\beta} \mod p = g^{\alpha * \beta} \mod p = \\&lt;br /&gt;
    &amp;amp;= (g^{\beta})^{\alpha} \mod p = b^{\alpha} \mod p \\&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The secrecy of Diffie-Hellman key exchange protocol is based on the computational difficulty of the discrete logarithms, more precisely on determining &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha&amp;lt;/math&amp;gt; from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = g^{\alpha} \mod p&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b = g^{\beta} \mod p&amp;lt;/math&amp;gt; in the knowledge of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;g&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; or &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;combinatorics&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Combinatorics ==&lt;br /&gt;
&lt;br /&gt;
For an introduction to basics of combinatorics see [https://en.wikipedia.org/wiki/Permutation Permutation] and [https://en.wikipedia.org/wiki/Combination Combination].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;relations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Relations ==&lt;br /&gt;
&lt;br /&gt;
For an introduction and overview on mathematical relations see [https://en.wikipedia.org/wiki/Relation_(mathematics) Relation].&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6495</id>
		<title>Informatik und IT</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Informatik_und_IT&amp;diff=6495"/>
		<updated>2025-01-15T13:31:56Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Introduction_to_Computational_and_Artificial_Intelligence|Introduction_to_Computational_and_Artificial_Intelligence]]&lt;br /&gt;
&lt;br /&gt;
[[Webserver Infrastructures|Webserver Infrastructures]]&lt;br /&gt;
&lt;br /&gt;
[[Cloud Computing Security|Cloud Computing Security]]&lt;br /&gt;
&lt;br /&gt;
[[KI in der Wirtschaft|KI in der Wirtschaft]]&lt;br /&gt;
&lt;br /&gt;
[[AI assisted Engineering|AI assisted Engineering]]&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6449</id>
		<title>Benutzer:SAFFER Zsolt</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6449"/>
		<updated>2024-09-24T12:21:14Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Zsolt Saffer - kurze Biografie&lt;br /&gt;
&lt;br /&gt;
[[Datei:ZsS_Ausweis_thumbnail_592.jpg|140px|thunb|left]]&lt;br /&gt;
&lt;br /&gt;
Zsolt Saffer studierte Elektrotechnik und Informatik an der Technischen Universität Budapest, später genannt als Technische und Wirtschaftswissenschaftliche Universität Budapest (BUTE). Mehr als ein Jahrzehnt lang war er als Software- und Technologieentwicklungsingenieur bei Alcatel Austria, Wien und Philips Speech Recognition Systems, Wien tätig. Er hat im Fach Informatik in 2010 promoviert. Er hat zahlreiche wissenschaftliche Artikel veröffentlicht und habilitierte sich als Privatdozent 2019 im Fach Angewandte Mathematik an der Technische Universität Wien. Er ist Lehrer für mathematische Stochastik an der Technische Universität Wien seit 2018. Ab Oktober 2023 ist er hauptberuflich als wissenschaftlicher Mitarbeiter an der FernFH tätig. Seine aktuellen Forschungsinteressen umfassen künstliche Intelligenz, maschinelles Lernen, Warteschlangentheorie und ihre Anwendungen vor allem in Gesundheitswesen, stochastische Modellierung vor allem im Bereich erneuerbarer Energien, vernetzte Fahrzeuge und Optimierung.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6448</id>
		<title>Benutzer:SAFFER Zsolt</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6448"/>
		<updated>2024-09-24T12:19:44Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Zsolt Saffer - kurze Biografie&lt;br /&gt;
&lt;br /&gt;
[[Datei:ZsS_Ausweis_thumbnail_592.jpg|140px|thumb|left]]&lt;br /&gt;
&lt;br /&gt;
Zsolt Saffer studierte Elektrotechnik und Informatik an der Technischen Universität Budapest, später genannt als Technische und Wirtschaftswissenschaftliche Universität Budapest (BUTE). Mehr als ein Jahrzehnt lang war er als Software- und Technologieentwicklungsingenieur bei Alcatel Austria, Wien und Philips Speech Recognition Systems, Wien tätig. Er hat im Fach Informatik in 2010 promoviert. Er hat zahlreiche wissenschaftliche Artikel veröffentlicht und habilitierte sich als Privatdozent 2019 im Fach Angewandte Mathematik an der Technische Universität Wien. Er ist Lehrer für mathematische Stochastik an der Technische Universität Wien seit 2018. Ab Oktober 2023 ist er hauptberuflich als wissenschaftlicher Mitarbeiter an der FernFH tätig. Seine aktuellen Forschungsinteressen umfassen künstliche Intelligenz, maschinelles Lernen, Warteschlangentheorie und ihre Anwendungen vor allem in Gesundheitswesen, stochastische Modellierung vor allem im Bereich erneuerbarer Energien, vernetzte Fahrzeuge und Optimierung.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:ZsS_Ausweis_thumbnail_592.jpg&amp;diff=6447</id>
		<title>Datei:ZsS Ausweis thumbnail 592.jpg</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Datei:ZsS_Ausweis_thumbnail_592.jpg&amp;diff=6447"/>
		<updated>2024-09-24T12:17:03Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6446</id>
		<title>Benutzer:SAFFER Zsolt</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Benutzer:SAFFER_Zsolt&amp;diff=6446"/>
		<updated>2024-09-24T12:10:07Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „Zsolt Saffer - kurze Biografie  Zsolt Saffer studierte Elektrotechnik und Informatik an der Technischen Universität Budapest, später genannt als Technische und Wirtschaftswissenschaftliche Universität Budapest (BUTE). Mehr als ein Jahrzehnt lang war er als Software- und Technologieentwicklungsingenieur bei Alcatel Austria, Wien und Philips Speech Recognition Systems, Wien tätig. Er hat im Fach Informatik in 2010 promoviert. Er hat zahlreiche wissensch…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Zsolt Saffer - kurze Biografie&lt;br /&gt;
&lt;br /&gt;
Zsolt Saffer studierte Elektrotechnik und Informatik an der Technischen Universität Budapest, später genannt als Technische und Wirtschaftswissenschaftliche Universität Budapest (BUTE). Mehr als ein Jahrzehnt lang war er als Software- und Technologieentwicklungsingenieur bei Alcatel Austria, Wien und Philips Speech Recognition Systems, Wien tätig. Er hat im Fach Informatik in 2010 promoviert. Er hat zahlreiche wissenschaftliche Artikel veröffentlicht und habilitierte sich als Privatdozent 2019 im Fach Angewandte Mathematik an der Technische Universität Wien. Er ist Lehrer für mathematische Stochastik an der Technische Universität Wien seit 2018. Ab Oktober 2023 ist er hauptberuflich als wissenschaftlicher Mitarbeiter an der FernFH tätig. Seine aktuellen Forschungsinteressen umfassen künstliche Intelligenz, maschinelles Lernen, Warteschlangentheorie und ihre Anwendungen vor allem in Gesundheitswesen, stochastische Modellierung vor allem im Bereich erneuerbarer Energien, vernetzte Fahrzeuge und Optimierung.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Literatur&amp;diff=6429</id>
		<title>Literatur</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Literatur&amp;diff=6429"/>
		<updated>2024-09-16T17:34:00Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;thebibliography&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Duda et al.(2001)] Richard O  Duda, Peter E.  Hart, David G. Stork. &amp;#039;&amp;#039;Pattern Classification&amp;#039;&amp;#039;. John Wiley &amp;amp;amp; Sons, 2001.&lt;br /&gt;
&lt;br /&gt;
[Siddique et al.(2013)] Nazmul Siddique, Hojjat Adeli. &amp;#039;&amp;#039;Computational Intelligence: Synergies of Fuzzy Logic, Neural Networks and Evolutionary Computing&amp;#039;&amp;#039;. John Wiley &amp;amp;amp; Sons, 2013.&lt;br /&gt;
&lt;br /&gt;
[FloridiCowls(2019)]Luciano Floridi, Josh Cowls: A Unified Framework of Five Principles for AI in Society. In &amp;#039;&amp;#039;Harvard Data Science Review&amp;#039;&amp;#039;, Band 1, Nr. 1, 2019. doi:10.1162/99608f92.8cd550d1&lt;br /&gt;
&lt;br /&gt;
[Devlin et al.(2019)] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In &amp;#039;&amp;#039;North American Chapter of the Association for Computational Linguistics: Human Language Technologies.&amp;#039;&amp;#039;, 2019.&lt;br /&gt;
&lt;br /&gt;
[Mikolov et al.(2013)] Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed Representations of Words and Phrases and their Compositionality. In &amp;#039;&amp;#039;NIPS.&amp;#039;&amp;#039;, 2013.&lt;br /&gt;
&lt;br /&gt;
[Vaswani et al.(2017)] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In &amp;#039;&amp;#039;Advances in neural information processing systems, 30&amp;#039;&amp;#039;, 2017.&lt;br /&gt;
&lt;br /&gt;
[Yamada et al.(2018)] Ikuya Yamada, Akari Asai, Jin Sakuma, Hiroyuki Shindo, Hideaki Takeda, Yoshiyasu  Takefuji, and Yuji Matsumoto. Wikipedia2vec: An efficient toolkit for learning and visualizing the embeddings of words and entities from wikipedia. In &amp;#039;&amp;#039;arXiv preprint arXiv:1812.06280&amp;#039;&amp;#039;, 2018.&lt;br /&gt;
&lt;br /&gt;
[Bengio(2008)] Yoshua Bengio. Neural net language models. &amp;#039;&amp;#039;Scholarpedia.&amp;#039;&amp;#039;, 3:3881, 2008. https://doi.org/10.4249/scholarpedia.3881&lt;br /&gt;
&lt;br /&gt;
[3] G. A  Miller. WordNet: A Lexical Database for English. &amp;#039;&amp;#039;Commun. ACM&amp;#039;&amp;#039;, 38(11), 39-41, Nov. 1995.&lt;br /&gt;
&lt;br /&gt;
[4] O. Bodenreider. The Unified Medical Language System (UMLS): integrating biomedical terminology. &amp;#039;&amp;#039;Nucleic Acids Research&amp;#039;&amp;#039;, 32, no. Database issue, D267–270, Jan. 2004.&lt;br /&gt;
&lt;br /&gt;
[5] K. Bollacker, C. Evans, P. Paritosh, T. Sturge, and J. Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In &amp;#039;&amp;#039;Proceedings of the 2008 ACM SIGMOD international conference on Management of data. ACM&amp;#039;&amp;#039;, 1247–1250, 2008.&lt;br /&gt;
&lt;br /&gt;
[6] D. Vrandecic and M. Krötzsch. Wikidata: a free collaborative knowledgebase. &amp;#039;&amp;#039;Communications of the ACM&amp;#039;&amp;#039;, 57(10), 78–85, 2014.&lt;br /&gt;
&lt;br /&gt;
[1] J. Hoffart, F. M. Suchanek, K. Berberich, and G. Weikum. YAGO2: a spatially and temporally enhanced knowledge base from Wikipedia. &amp;#039;&amp;#039;Artificial Intelligence&amp;#039;&amp;#039;, 194, 28–61, 2013.&lt;br /&gt;
&lt;br /&gt;
[7] S. Auer, C. Bizer, G. Kobilarov, J. Lehmann, R. Cyganiak, and Z. Ives. &amp;#039;&amp;#039;DBpedia: A Nucleus for a Web of Open Data&amp;#039;&amp;#039;. in The Semantic Web. Springer Berlin Heidelberg, vol. 4825, pp. 722–735, 2007.&lt;br /&gt;
&lt;br /&gt;
[8] A. Carlson, J. Betteridge, B. Kisiel, B. Settles, E. R. H. Jr, and T. M. Mitchell. Toward an Architecture for Never-Ending Language Learning. In &amp;#039;&amp;#039;Proceedings of the Twenty-Fourth Conference on Artificial Intelligence (AAAI 2010), AAAI Press&amp;#039;&amp;#039;, 1306–1313, 2010.&lt;br /&gt;
&lt;br /&gt;
[2] X. Dong, E. Gabrilovich, G. Heitz, W. Horn, N. Lao, K. Murphy, T. Strohmann, S. Sun, and W. Zhang. Knowledge Vault: A Web-scale Approach to Probabilistic Knowledge Fusion. In &amp;#039;&amp;#039;Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. New York, NY, USA: ACM&amp;#039;&amp;#039;, 601–610, 2014.&lt;br /&gt;
&lt;br /&gt;
[9] J. Fan, D. Ferrucci, D. Gondek, and A. Kalyanpur, Prismatic: Inducing knowledge from a large scale lexicalized relation resource. In &amp;#039;&amp;#039;Proceedings of the NAACL HLT 2010 First International Workshop on Formalisms and Methodology for Learning by Reading, Association for Computational Linguistics&amp;#039;&amp;#039;, 122–127, 2010.&lt;br /&gt;
&lt;br /&gt;
[Biswas(2003)] Russa. Biswas. &amp;#039;&amp;#039;Embedding Based Link Prediction for Knowledge Graph Completion. Ph. D. dissertation&amp;#039;&amp;#039;. PhD thesis, Karlsruher Institut für Technologie (KIT), Germany, 2003. https://doi.org/10.5445/IR/1000156436&lt;br /&gt;
&lt;br /&gt;
[Ji et al.(2022)] S. Ji, S. Pan, E. Cambria, P. Marttinen and P. S. Yu,. A Survey on Knowledge Graphs: Representation, Acquisition, and Applications. In &amp;#039;&amp;#039;IEEE Transactions on Neural Networks and Learning Systems&amp;#039;&amp;#039;, 33(2),494-514, 2022. doi: 10.1109/TNNLS.2021.3070843&lt;br /&gt;
&lt;br /&gt;
[Nickel et al.(2016)] M. Nickel, K. .Murphy, V. Tresp, and E. Gabrilovich. A Review of Relational Machine Learning for Knowledge Graphs. In &amp;#039;&amp;#039;Proceedings of the IEEE, Institute of Electrical and Electronics Engineers (IEEE)&amp;#039;&amp;#039;, 104(1):11-33, 2016. http://dx.doi.org/10.1109/JPROC.2015.2483592&lt;br /&gt;
&lt;br /&gt;
[Kejriwal(2022)] Mayank Kejriwal. Knowledge Graphs: A Practical Review of the Research Landscape. &amp;#039;&amp;#039;Information&amp;#039;&amp;#039;, 13(4), 161, 1-17, 2022. https://doi.org/10.3390/info13040161&lt;br /&gt;
&lt;br /&gt;
[Pflueger et al.(2022)] Maximilian Pflueger, David J. Tena Cucala, and Egor V. Kostylev. GNNQ: A Neuro-Symbolic Approach to Query Answering over Incomplete Knowledge Graphs. In &amp;#039;&amp;#039;The Semantic Web – ISWC 2022, Springer International Publishing&amp;#039;&amp;#039;, 481–497, 2022.&lt;br /&gt;
&lt;br /&gt;
[Pan et al.(2024)] Shirui Pan, Linhao Luo, Yufei Wang, Chen Chen, Jiapu Wang, and Xindong Wu. Unifying Large Language Models and Knowledge Graphs: A Roadmap. &amp;#039;&amp;#039;IEEE Transactions on Knowledge and Data Engineering, Institute of Electrical and Electronics Engineers (IEEE)&amp;#039;&amp;#039;, 56(4), 1–20, 2024. http://dx.doi.org/10.1109/TKDE.2024.3352100&lt;br /&gt;
&lt;br /&gt;
[Zhong et al.(2023)] Lingfeng Zhong, Jia Wu, Qian Li, Hao Peng, and Xindong Wu. A Comprehensive Survey on Automatic Knowledge Graph Construction. &amp;#039;&amp;#039;ACM Computing Surveys&amp;#039;&amp;#039;, 56(4), Article No.: 94, 1–62, 2023. https://doi.org/10.1145/3618295&lt;br /&gt;
&lt;br /&gt;
[Fisher(1936)] R.A. Fisher. The Use of Multiple Measurements in Taxonomic Problems. &amp;#039;&amp;#039;Annals of Eugenics.&amp;#039;&amp;#039;, 7 (2): 179–188, 1963. https://doi:10.1111/j.1469-1809.1936.tb02137.x.&lt;br /&gt;
&lt;br /&gt;
[Vapnik and Chervonenkis(1971)] V. N. Vapnik, and A. Y. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. &amp;#039;&amp;#039;Theory of Probability and Its Applications&amp;#039;&amp;#039;, 16, 264–280, 1971.&lt;br /&gt;
&lt;br /&gt;
[Blumer et al.(1989)] A. Blumer, A. Ehrenfeucht, D. Haussler, and M. K. Warmuth. Learnability and the Vapnik–Chervonenkis dimension. &amp;#039;&amp;#039;Journal of the ACM&amp;#039;&amp;#039;, 36(4), 929––865, 1989.&lt;br /&gt;
&lt;br /&gt;
[Vapnik(1995)] V. N. Vapnik. &amp;#039;&amp;#039;The Nature of Statistical Learning Theory&amp;#039;&amp;#039;. Springer, New York., 1995.&lt;br /&gt;
&lt;br /&gt;
[Wolpert9(1996)] D. H. Wolpert. The lack of a priori distinction between learning algorithms. &amp;#039;&amp;#039;Neural Computation&amp;#039;&amp;#039;, 8(7), 1341–1390, 1996.&lt;br /&gt;
&lt;br /&gt;
[McCulloch and Pitts(1943)] W. S. McCulloch and W. Pitts. A logical calculus of ideas immanent in nervous activity. &amp;#039;&amp;#039;Bulletin of Mathematical Biophysics&amp;#039;&amp;#039;, 5, 115–133, 1943.&lt;br /&gt;
&lt;br /&gt;
[Rosenblatt(1958)] Frank Rosenblatt. The perceptron. A probabilistic model for information storage and organization in the brain. &amp;#039;&amp;#039;Psychological Reviews&amp;#039;&amp;#039;, 65, 386–408, 1958.&lt;br /&gt;
&lt;br /&gt;
[Goodfellow et al.(2016)] I. Goodfellow, Y. Bengio, and A. Courville. &amp;#039;&amp;#039;Deep Learning&amp;#039;&amp;#039;. MIT Press, 2016.&lt;br /&gt;
&lt;br /&gt;
[Reynolds(2021)] Anh Reynolds. &amp;#039;&amp;#039;Understanding convolutional neural networks (cnns).&amp;#039;&amp;#039; https://anhreynolds.com/blogs/cnn.html, 2021 Accessed: 2024-02-11.&lt;br /&gt;
&lt;br /&gt;
[JurafskyMartin(2023)] Daniel Jurafsky and James H. Martin. &amp;#039;&amp;#039;Speech and Language Processing&amp;#039;&amp;#039;. https://web.stanford.edu/ jurafsky/slp3, 2023&lt;br /&gt;
&lt;br /&gt;
[Hochreiter(1991)] S. Hochreiter. &amp;#039;&amp;#039;Untersuchungen zu dynamischen neuronalen Netzen. Diplom thesis&amp;#039;&amp;#039;. Diplom thesis, Institut f. Informatik, Technische Univ. Munich., Germany, 1991.&lt;br /&gt;
&lt;br /&gt;
[CARTPennStateCourse(2024)] Penn State’s Department of Statistics. &amp;#039;&amp;#039;Course notes for STAT 508: Applied Data Mining and Statistical Learning, Lesson 11&amp;#039;&amp;#039;. https://online.stat.psu.edu/stat508/, 2024 Creative Commons license CC BY-NC 4.0&lt;br /&gt;
&lt;br /&gt;
[Breiman(1996)] Leo Breiman. Bagging predictors. &amp;#039;&amp;#039;Machine Learning&amp;#039;&amp;#039;, 24(2), 123–140, 1996. doi:10.1007/BF00058655&lt;br /&gt;
&lt;br /&gt;
[Elman(1990)] J. L. Elman. Finding structure in time. &amp;#039;&amp;#039;Cognitive science&amp;#039;&amp;#039;, 14(2), 179–211, 1990.&lt;br /&gt;
&lt;br /&gt;
[Werbos(1974)] P. Werbos. &amp;#039;&amp;#039;Beyond regression: new tools for prediction and analysis in the behavioral sciences. Ph.D. thesis&amp;#039;&amp;#039;. Ph.D. thesis, Harvard University, USA, 1974.&lt;br /&gt;
&lt;br /&gt;
[SchusterPaliwal(1997)] M. Schuster and K. K. Paliwal. Bidirectional recurrent neural networks. &amp;#039;&amp;#039;IEEE Transactions on Signal Processing&amp;#039;&amp;#039;, 45, 2673–2681, 1997.&lt;br /&gt;
&lt;br /&gt;
[HochreiterSchmidhuber(1997)] S. Hochreiter and J. Schmidhuber. Long short-term memory. &amp;#039;&amp;#039;Neural Computation&amp;#039;&amp;#039;, 9(8),1735–1780, 1997.&lt;br /&gt;
&lt;br /&gt;
[Bellman(1957)] Richard Bellman. A Markovian Decision Process. &amp;#039;&amp;#039;Journal of Mathematics and Mechanics&amp;#039;&amp;#039;, 6(5):679–684, 1957. http://www.jstor.org/stable/24900506&lt;br /&gt;
&lt;br /&gt;
[Bertsekas(1987)] Dimitri P. Bertsekas. Dynamic Programming: Deterministic and Stochastic Models. Prentice-Hall, 1987.&lt;br /&gt;
&lt;br /&gt;
[LittmanDeanKaelbling(1995)] M. L. Littman, T. L. Dean, and L. P. Kaelbling. On the complexity of solving Markov decision problems. In &amp;#039;&amp;#039;Proceedings of the Eleventh Annual Conference on Uncertainty in Articial Intelligence (UAI-95)&amp;#039;&amp;#039;, Montreal, Québec, Canada, 1995.&lt;br /&gt;
&lt;br /&gt;
[Li(2018)] Y. Li. Deep reinforcement learning. . https://arxiv.org/abs/1810.06339 arXiv:1810.06339&lt;br /&gt;
&lt;br /&gt;
[Son et al.(2022)] Ki Young Son, Jongwoo Ko, Eunseok Kim, Si Young Lee, Min-Ji Kim, Jisang Han, Eunhae Shin, Tae-Young Chung, and Dong Hui Lim. Deep learningbased cataract detection and grading from slit-lamp and retro-illumination&lt;br /&gt;
photographs: Model development and validation study.. &amp;#039;&amp;#039;Ophthalmology Science&amp;#039;&amp;#039;, 2(2), 2022.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Evaluierung_und_Verbesserung_von_AI-Modellen&amp;diff=6428</id>
		<title>Evaluierung und Verbesserung von AI-Modellen</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Evaluierung_und_Verbesserung_von_AI-Modellen&amp;diff=6428"/>
		<updated>2024-09-16T17:32:10Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;evaluierung-und-verbesserung-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Evaluierung und Verbesserung von KI-Modellen =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluierung-von-klassifikations--und-regressionsmodellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluierung von Klassifikations- und Regressionsmodellen ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;bewertungsmetriken-zur-klassifizierung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Bewertungsmetriken zur Klassifizierung ===&lt;br /&gt;
&lt;br /&gt;
Ein Klassifizierungsmodell wird anhand der Testdaten ausgewertet. Die zur Bewertung des Modells am häufigsten verwendeten allgemeinen Bewertungsmetriken (evaluation metrics) sind wie folgt aufgeführt:&lt;br /&gt;
&lt;br /&gt;
* Accuracy (Genauigkeit),&lt;br /&gt;
* Konfusionsmatrix (confusion matrix),&lt;br /&gt;
* Precision und Recall (Präzision und Rückruf),&lt;br /&gt;
&lt;br /&gt;
Die Accuracy ist das Verhältnis der korrekt klassifizierten Beispiele zur Gesamtzahl der Beispiele im Testdaten. Definiert man wahre Beispiele (true examples - TE) und falsche Beispiele (false examples - FE) als Anzahl der korrekt und falsch klassifizierten Beispiele im Testdaten, kann die Accuracy wie folgt angegeben werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TE}{TE+FE}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Konfusionsmatrix ist eine Metrik zur Visualisierung der Klassifizierungsleistung (classification performance). Die Zeilen der Matrix stellen die wahren Klassen dar und die Spalten zeigen die vorhergesagten Klassen. Das Element (i,j) der Matrix zeigt die Anzahl der Testbeispiele, die zur Klasse i gehören und als Klasse j klassifiziert sind. Die Konfusionsmatrix zeigt also nicht nur die Anzahl der korrekt klassifizierten Beispiele für jede Klasse, sondern auch eine Vorstellung von typischen Fehlklassifizierungen, die das Modell vornimmt. Eine Beispiel-Konfusionsmatrix ist in Abbildung [[#fig:EvalMetric_1|49]] zu sehen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:EvalMetric_1&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:EvalMetric_ConfMatrExa.jpg|300px|thumb|center|Abbildung 49: Eine Beispiel-Konfusionsmatrix für ein Klassifizierungsmodell mit 3 Klassen.]] &amp;lt;span id=&amp;quot;fig:EvalMetric_1&amp;quot; label=&amp;quot;fig:EvalMetric_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Die Metriken Precision und Recall wurden ursprünglich für binäre Klassifizierungsmodelle eingeführt, ihre Verwendung kann jedoch auf Mehrklassenfälle (multiclass case) ausgeweitet werden. Daher werden sie zunächst für binäre Klassifizierungsmodelle definiert und erläutert.&lt;br /&gt;
&lt;br /&gt;
In binärer Klassifizierungsaufgabe mit positiven und negativen Klassen kann das Ergebnis der Klassifizierungsaufgabe in einen von vier Fällen eingeteilt werden: richtig/falsch (correctly/incorrectly) klassifizierte Beispiele, die zur positiven/negativen Klasse (positive/negative class) gehören. Die Vorhersage ist true positive (TP), wenn ein positives Beispiel richtig klassifiziert wird, wie z. B. das Vorhandensein einer Krankheit. Eine false negative (FN) Vorhersage tritt auf, wenn ein positives Beispiel vom Modell als zur negativen Klasse gehörend klassifiziert wird. Ebenso tritt eine true negative (TN) Vorhersage auf, wenn ein negatives Beispiel richtig klassifiziert wird. Schließlich ist die Vorhersage false positive (FP), wenn ein negatives Beispiel als zur positiven Klasse gehörend klassifiziert wird. Diese Fälle sind in Tabelle [[#tab:poss_predictions|5]] zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:poss_predictions&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Mögliche Fälle des Ergebnisses der Klassifizierungsaufgabe (=Vorhersage)&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| true &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\backslash&amp;lt;/math&amp;gt; predicted  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   positive  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| positive  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true positive (TP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false negative (FN)&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| negative  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false positive (FP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true negative (TN)&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Für den Fall der binären Klassifizierung kann die Accuracy alternativ wie folgt definiert werden: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TP+TN}{TP+TN+FP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Begriffe TP, FN, TN und FP werden auch verwendet, um die Anzahl der entsprechenden Fälle zu bezeichnen, z. B. bezeichnet TP auch die Anzahl der echten positiven Ergebnisse.&lt;br /&gt;
&lt;br /&gt;
Precision ist das Verhältnis der richtig klassifizierten positiven Beispiele zur Gesamtzahl der als positiv klassifizierten Beispiele:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Precision} = \frac{TP}{TP+FP}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Im Gegensatz dazu bezeichnet der Recall das Verhältnis der richtig klassifizierten Positivbeispiele zur Gesamtzahl der Positivbeispiele: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Recall} = \frac{TP}{TP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In einer Multi-Class-Setting werden die Metriken Precision und Recall zunächst für jede Klasse einzeln berechnet und dann gemittelt. Auf diese Weise quantifizieren sie die Gesamtklassifizierungsleistung (overall classification performance).&lt;br /&gt;
&lt;br /&gt;
Die Verwendung der verschiedenen Metriken ist in der Tabelle [[#tab:use_metrics|6]] zusammengefasst&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:use_metrics&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Die Verwendung der verschiedenen Metriken.&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Bewertungsmetrik&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   Wann verwenden?  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Accuracy  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Bei Klassifizierungsproblemen&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| mit ausgeglichenen Klassen  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Precision  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Wenn es wichtig ist, sich der positiven Vorhersage&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| sicher zu sein, um negative Konsequenzen zu vermeiden,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| wie z.B. im Falle einer Verringerung des Kreditlimits,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| um Unzufriedenheit beim Kunden zu vermeiden.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Recall  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Wenn es wichtig ist, positive Ereignisse mit&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| geringer Wahrscheinlichkeit zu erfassen, wie z.B. um&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| vorherzusagen ob eine Person krank ist oder nicht.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-regression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metrics for regression ===&lt;br /&gt;
&lt;br /&gt;
Die am häufigsten verwendeten Metriken, die zur Bewertung von Regressionsmodellen verwendet werden, sind hier aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* Mean Squared Error - MSE (Mittlerer quadrierter Fehler),&lt;br /&gt;
* Mean Absolute Error - MAE (Mittlerer absoluter Fehler),&lt;br /&gt;
&lt;br /&gt;
Der Mean Squared Error (MSE) ist eine der grundlegenden Statistiken zur Bewertung der Qualität eines Regressionsmodells. Es handelt sich um den Durchschnitt der Quadrate der Differenz zwischen den tatsächlichen und den vorhergesagten Werten. Mit anderen Worten:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MSE} = \frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2.&amp;lt;/math&amp;gt; Je kleiner der MSE, desto besser passt das Regressionsmodell zu den tatsächlichen Werten.&lt;br /&gt;
&lt;br /&gt;
Der Mean Absolute Error (MAE) ist die durchschnittliche absolute Differenz zwischen den tatsächlichen und den vorhergesagten Werten. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAE} = \frac{1}{K}\sum_{k}|y_k - \hat{y}_k|&amp;lt;/math&amp;gt; Eine schöne Eigenschaft des MAE ist, dass er weniger wahrscheinlich von Extremwerten beeinflusst wird. Er ist ein gängiges Maß, das in der Zeitreihenanalyse (time series analysis) als Prognosefehler (forecast error) verwendet wird.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;verbesserungen-und-anpassungen-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Verbesserungen und Anpassungen von KI-Modellen ==&lt;br /&gt;
&lt;br /&gt;
Die Konstruktion eines KI-Modells ist keine triviale Aufgabe. Die häufigsten Probleme sind die folgenden.&lt;br /&gt;
&lt;br /&gt;
# Keine oder langsame Konvergenz während des Training.&lt;br /&gt;
# Unzureichende Leistung, z. B.&lt;br /&gt;
#* zu niedrige Accuracy oder&lt;br /&gt;
#* gestreute (nicht diagonal zentriert) Konfusionsmatrix.&lt;br /&gt;
&lt;br /&gt;
Diese Probleme erfordern Verbesserungen bzw. Anpassungen am KI-Modell. Nachfolgend werden die häufigsten Ursachen für keine oder langsame Konvergenz während des Trainings sowie einige mögliche Lösungsansätze für sie aufgelistet.&lt;br /&gt;
&lt;br /&gt;
* Nicht optimale Stopping Kriterium oder leistungsswäche Hardware. In dem Fall können die folgenden Anpassungen helfen.&lt;br /&gt;
** Einsetzen von Kriterium des „Early Stopping“.&lt;br /&gt;
** Einsetsen von leistungsstärkere Hardware (einschließlich Prozessor,&amp;lt;br /&amp;gt;&lt;br /&gt;
RAM und Grafikkarte).&lt;br /&gt;
* Unzureichende Optimierungsverfahren. Bei Verwendung einer unzureichenden Optimierungsmethode muss die potenziell beste Optimierungsmethode auf Grundlage früherer Erfahrungen mit Aufgaben in ähnlichen Fachgebieten ausgewählt werden. Diese Auswahl erfodert Erfahrung mit KI-Modelle und tiefes Verständnis der Aufgabe.&lt;br /&gt;
* Unzureichende Initialisierung der Parameter. Dies kann durch Ändern oder Anpassen der (heuristischen) Initialisierungsstrategie verbessert werden.&lt;br /&gt;
* Kein richtige Hyperparameter-Einstellungen (einschliesslich der Parameter von der verwendeten Optimierungsalgorithmus). Dieses Problem kann durch Ausprobieren mehrerer Hyperparameter-Einstellungen (einschliesslich Minibatch- Größe) oder Anwenden von Regularizationstechniken gelöst werden.&lt;br /&gt;
* „Vanishing Gradient Problem“ (in DL mit Anzahl von Hidden Layers in der Größenordnung von 100s). Dies ist ein bekanntes und gut eingegrenztes Problem, welches durch die Verwendung eines etablierten Ansatzes, der zum KI-Modell passt, vermieden werden. (Etablierte Ansätze befinden sich unter [https://en.wikipedia.org/wiki/Vanishing_gradient_problem Vanishing_gradient_problem])&lt;br /&gt;
&lt;br /&gt;
Eine unvollständige Liste möglicher Ursachen für unzureichende Leistung auf Testdaten und einige mögliche Lösungsansätze für sie sind nachstehend aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* Underfitting. Um Underfitting zu vermeiden, müssen die Größe der Trainingsdaten erhöht werden.&lt;br /&gt;
* Overfitting. Es gibt mehrere Techniken um Overfitting zu reduzieren. Einige sind wie folgt aufgelistet.&lt;br /&gt;
** Verwenden größerer Trainingsdaten.&lt;br /&gt;
** Verwenden von Methoden wie Bootstrap-Aggregation oder Random Forest um die Varianz neben gleichem Bias zum reduzieren.&lt;br /&gt;
** Verwenden von Dropout Layer - in CNN Modellen.&lt;br /&gt;
* Class Imbalance: die Trainingsdaten sind ungleichmäßig auf die Klassen verteilt. Diese wirkt sich negativ auf die Leistung der CNN-Klassifizierung aus [Son et al.(2022)]. Das Problem von Class Imbalance kann gelöst werden, indem die Größe der Trainingsdaten für jede Klasse ausgeglichen wird. Dies kann auf verschiedene Weise erreicht werden, wie z.B.&lt;br /&gt;
** Verwenden zusätzlicher Trainingsbeispiele,&lt;br /&gt;
** Zusammenführen von Trainingsdaten aus mehreren Klassen oder&lt;br /&gt;
* Nicht optimale Hyperparameter-Einstellungen. Siehe oben beim Ursachen von keiner oder langsamer Konvergenz während des Trainings.&lt;br /&gt;
* Nicht optimale Initialisierung der Parameter. Siehe oben beim Ursachen von keiner oder langsamer Konvergenz während des Trainings.&lt;br /&gt;
* Inadäquate KI-Modell. Das Design des geegneten KI-Modells erfolgt normalerweisse iterative. Jeder Schritt zur Verbesserung des KI-Modells führt zu einem besseren Verständnis der Aufgabe. Der Design von komplexerer KI-Modell/DL-Architektur efordert ein hohes Maß an Erfahrung mit KI-Modellen/DL-Architekturen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;stärken-und-schwächen-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Stärken und Schwächen von KI-Modellen ==&lt;br /&gt;
&lt;br /&gt;
KI-Modelle haben wie alle technischen Lösungen Stärken und Schwächen.&lt;br /&gt;
&lt;br /&gt;
Einige der Stärken von KI-Modellen können wie folgt aufgelistet werden.&lt;br /&gt;
&lt;br /&gt;
# Eine ihre größte Stärke ist ihre Generalisierungsfähigkeit. ML-Algorithmen können ihren Aufgaben auch mit unbekannten Eingabebeispielen gut ausführen.&lt;br /&gt;
# KI-Modelle sind in der Lage, ihre Leistung für eine bestimmte Aufgabe durch zusätzliche Trainingsdaten zu verbessern.&lt;br /&gt;
# Sie können viele Aufgaben realisieren, die auf eine oder Kombination von mehreren der folgenden Intelligenz fordernden Aufgaben zurückgeführt werden können: Regression, Klassifizierung, Representation Learning und optimale Kontrolle.&lt;br /&gt;
# Sie haben eine sehr breite Anwendbarkeit: mit KI-Modellen können neue Anwendungen praktisch in allen möglichen Anwendungsbereichen implementiert werden.&lt;br /&gt;
# In den meisten Anwendungsfällen sind sie schneller als Menschen.&lt;br /&gt;
# Bei einigen Aufgaben sind sie leistungsfähiger (z. B. bei der Genauigkeit von Klassifizierungsaufgaben) als die menschliche Intelligenz.&lt;br /&gt;
&lt;br /&gt;
Nachfolgend befindet sich eine unvollständige Liste der Schwächen von KI-Modellen.&lt;br /&gt;
&lt;br /&gt;
# Enige KI-Modelle (z.B. NNs) sind als Black Box zu sehen, d.h. ihre Arbeitsweise ist nicht gut genug verstanden.&lt;br /&gt;
# Alle KI-Modelle machen eventuell Fehler z.B. bei Klassifikationsaufgaben.&lt;br /&gt;
# Indem sie potenziell fehlerhafte Ergebnisse produzieren, werfen sie ethische Fragen auf.&lt;br /&gt;
# Da sie potenziell fehlerhafte Ergebnisse produzieren, können sie nicht zur Entscheidungsfindung verwendet werden, sondern nur für Assistenzanwendungen.&lt;br /&gt;
# KI-Modelle sind nicht universell, der Anwendungsbereich jedes KI-Algorithmus ist spezifisch, d. h. jeder KI-Algorithmus hat einen begrenzten Anwendungsbereich.&lt;br /&gt;
# Heutige KI-Modelle können viele Fähigkeiten der menschlichen Intelligenz nicht ausführen (wie Abstraktion, Konzepterstellung, analytisches Denken usw.).&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Literatur&amp;diff=6427</id>
		<title>Literatur</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Literatur&amp;diff=6427"/>
		<updated>2024-09-14T23:25:43Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div class=&amp;quot;thebibliography&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[Duda et al.(2001)] Richard O  Duda, Peter E.  Hart, David G. Stork. &amp;#039;&amp;#039;Pattern Classification&amp;#039;&amp;#039;. John Wiley &amp;amp;amp; Sons, 2001.&lt;br /&gt;
&lt;br /&gt;
[Siddique et al.(2013)] Nazmul Siddique, Hojjat Adeli. &amp;#039;&amp;#039;Computational Intelligence: Synergies of Fuzzy Logic, Neural Networks and Evolutionary Computing&amp;#039;&amp;#039;. John Wiley &amp;amp;amp; Sons, 2013.&lt;br /&gt;
&lt;br /&gt;
[FloridiCowls(2019)]Luciano Floridi, Josh Cowls: A Unified Framework of Five Principles for AI in Society. In &amp;#039;&amp;#039;Harvard Data Science Review&amp;#039;&amp;#039;, Band 1, Nr. 1, 2019. doi:10.1162/99608f92.8cd550d1&lt;br /&gt;
&lt;br /&gt;
[Devlin et al.(2019)] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In &amp;#039;&amp;#039;North American Chapter of the Association for Computational Linguistics: Human Language Technologies.&amp;#039;&amp;#039;, 2019.&lt;br /&gt;
&lt;br /&gt;
[Mikolov et al.(2013)] Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed Representations of Words and Phrases and their Compositionality. In &amp;#039;&amp;#039;NIPS.&amp;#039;&amp;#039;, 2013.&lt;br /&gt;
&lt;br /&gt;
[Vaswani et al.(2017)] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In &amp;#039;&amp;#039;Advances in neural information processing systems, 30&amp;#039;&amp;#039;, 2017.&lt;br /&gt;
&lt;br /&gt;
[Yamada et al.(2018)] Ikuya Yamada, Akari Asai, Jin Sakuma, Hiroyuki Shindo, Hideaki Takeda, Yoshiyasu  Takefuji, and Yuji Matsumoto. Wikipedia2vec: An efficient toolkit for learning and visualizing the embeddings of words and entities from wikipedia. In &amp;#039;&amp;#039;arXiv preprint arXiv:1812.06280&amp;#039;&amp;#039;, 2018.&lt;br /&gt;
&lt;br /&gt;
[Bengio(2008)] Yoshua Bengio. Neural net language models. &amp;#039;&amp;#039;Scholarpedia.&amp;#039;&amp;#039;, 3:3881, 2008. https://doi.org/10.4249/scholarpedia.3881&lt;br /&gt;
&lt;br /&gt;
[3] G. A  Miller. WordNet: A Lexical Database for English. &amp;#039;&amp;#039;Commun. ACM&amp;#039;&amp;#039;, 38(11), 39-41, Nov. 1995.&lt;br /&gt;
&lt;br /&gt;
[4] O. Bodenreider. The Unified Medical Language System (UMLS): integrating biomedical terminology. &amp;#039;&amp;#039;Nucleic Acids Research&amp;#039;&amp;#039;, 32, no. Database issue, D267–270, Jan. 2004.&lt;br /&gt;
&lt;br /&gt;
[5] K. Bollacker, C. Evans, P. Paritosh, T. Sturge, and J. Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In &amp;#039;&amp;#039;Proceedings of the 2008 ACM SIGMOD international conference on Management of data. ACM&amp;#039;&amp;#039;, 1247–1250, 2008.&lt;br /&gt;
&lt;br /&gt;
[6] D. Vrandecic and M. Krötzsch. Wikidata: a free collaborative knowledgebase. &amp;#039;&amp;#039;Communications of the ACM&amp;#039;&amp;#039;, 57(10), 78–85, 2014.&lt;br /&gt;
&lt;br /&gt;
[1] J. Hoffart, F. M. Suchanek, K. Berberich, and G. Weikum. YAGO2: a spatially and temporally enhanced knowledge base from Wikipedia. &amp;#039;&amp;#039;Artificial Intelligence&amp;#039;&amp;#039;, 194, 28–61, 2013.&lt;br /&gt;
&lt;br /&gt;
[7] S. Auer, C. Bizer, G. Kobilarov, J. Lehmann, R. Cyganiak, and Z. Ives. &amp;#039;&amp;#039;DBpedia: A Nucleus for a Web of Open Data&amp;#039;&amp;#039;. in The Semantic Web. Springer Berlin Heidelberg, vol. 4825, pp. 722–735, 2007.&lt;br /&gt;
&lt;br /&gt;
[8] A. Carlson, J. Betteridge, B. Kisiel, B. Settles, E. R. H. Jr, and T. M. Mitchell. Toward an Architecture for Never-Ending Language Learning. In &amp;#039;&amp;#039;Proceedings of the Twenty-Fourth Conference on Artificial Intelligence (AAAI 2010), AAAI Press&amp;#039;&amp;#039;, 1306–1313, 2010.&lt;br /&gt;
&lt;br /&gt;
[2] X. Dong, E. Gabrilovich, G. Heitz, W. Horn, N. Lao, K. Murphy, T. Strohmann, S. Sun, and W. Zhang. Knowledge Vault: A Web-scale Approach to Probabilistic Knowledge Fusion. In &amp;#039;&amp;#039;Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. New York, NY, USA: ACM&amp;#039;&amp;#039;, 601–610, 2014.&lt;br /&gt;
&lt;br /&gt;
[9] J. Fan, D. Ferrucci, D. Gondek, and A. Kalyanpur, Prismatic: Inducing knowledge from a large scale lexicalized relation resource. In &amp;#039;&amp;#039;Proceedings of the NAACL HLT 2010 First International Workshop on Formalisms and Methodology for Learning by Reading, Association for Computational Linguistics&amp;#039;&amp;#039;, 122–127, 2010.&lt;br /&gt;
&lt;br /&gt;
[Biswas(2003)] Russa. Biswas. &amp;#039;&amp;#039;Embedding Based Link Prediction for Knowledge Graph Completion. Ph. D. dissertation&amp;#039;&amp;#039;. PhD thesis, Karlsruher Institut für Technologie (KIT), Germany, 2003. https://doi.org/10.5445/IR/1000156436&lt;br /&gt;
&lt;br /&gt;
[Ji et al.(2022)] S. Ji, S. Pan, E. Cambria, P. Marttinen and P. S. Yu,. A Survey on Knowledge Graphs: Representation, Acquisition, and Applications. In &amp;#039;&amp;#039;IEEE Transactions on Neural Networks and Learning Systems&amp;#039;&amp;#039;, 33(2),494-514, 2022. doi: 10.1109/TNNLS.2021.3070843&lt;br /&gt;
&lt;br /&gt;
[Nickel et al.(2016)] M. Nickel, K. .Murphy, V. Tresp, and E. Gabrilovich. A Review of Relational Machine Learning for Knowledge Graphs. In &amp;#039;&amp;#039;Proceedings of the IEEE, Institute of Electrical and Electronics Engineers (IEEE)&amp;#039;&amp;#039;, 104(1):11-33, 2016. http://dx.doi.org/10.1109/JPROC.2015.2483592&lt;br /&gt;
&lt;br /&gt;
[Kejriwal(2022)] Mayank Kejriwal. Knowledge Graphs: A Practical Review of the Research Landscape. &amp;#039;&amp;#039;Information&amp;#039;&amp;#039;, 13(4), 161, 1-17, 2022. https://doi.org/10.3390/info13040161&lt;br /&gt;
&lt;br /&gt;
[Pflueger et al.(2022)] Maximilian Pflueger, David J. Tena Cucala, and Egor V. Kostylev. GNNQ: A Neuro-Symbolic Approach to Query Answering over Incomplete Knowledge Graphs. In &amp;#039;&amp;#039;The Semantic Web – ISWC 2022, Springer International Publishing&amp;#039;&amp;#039;, 481–497, 2022.&lt;br /&gt;
&lt;br /&gt;
[Pan et al.(2024)] Shirui Pan, Linhao Luo, Yufei Wang, Chen Chen, Jiapu Wang, and Xindong Wu. Unifying Large Language Models and Knowledge Graphs: A Roadmap. &amp;#039;&amp;#039;IEEE Transactions on Knowledge and Data Engineering, Institute of Electrical and Electronics Engineers (IEEE)&amp;#039;&amp;#039;, 56(4), 1–20, 2024. http://dx.doi.org/10.1109/TKDE.2024.3352100&lt;br /&gt;
&lt;br /&gt;
[Zhong et al.(2023)] Lingfeng Zhong, Jia Wu, Qian Li, Hao Peng, and Xindong Wu. A Comprehensive Survey on Automatic Knowledge Graph Construction. &amp;#039;&amp;#039;ACM Computing Surveys&amp;#039;&amp;#039;, 56(4), Article No.: 94, 1–62, 2023. https://doi.org/10.1145/3618295&lt;br /&gt;
&lt;br /&gt;
[Fisher(1936)] R.A. Fisher. The Use of Multiple Measurements in Taxonomic Problems. &amp;#039;&amp;#039;Annals of Eugenics.&amp;#039;&amp;#039;, 7 (2): 179–188, 1963. https://doi:10.1111/j.1469-1809.1936.tb02137.x.&lt;br /&gt;
&lt;br /&gt;
[Vapnik and Chervonenkis(1971)] V. N. Vapnik, and A. Y. Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. &amp;#039;&amp;#039;Theory of Probability and Its Applications&amp;#039;&amp;#039;, 16, 264–280, 1971.&lt;br /&gt;
&lt;br /&gt;
[Blumer et al.(1989)] A. Blumer, A. Ehrenfeucht, D. Haussler, and M. K. Warmuth. Learnability and the Vapnik–Chervonenkis dimension. &amp;#039;&amp;#039;Journal of the ACM&amp;#039;&amp;#039;, 36(4), 929––865, 1989.&lt;br /&gt;
&lt;br /&gt;
[Vapnik(1995)] V. N. Vapnik. &amp;#039;&amp;#039;The Nature of Statistical Learning Theory&amp;#039;&amp;#039;. Springer, New York., 1995.&lt;br /&gt;
&lt;br /&gt;
[Wolpert9(1996)] D. H. Wolpert. The lack of a priori distinction between learning algorithms. &amp;#039;&amp;#039;Neural Computation&amp;#039;&amp;#039;, 8(7), 1341–1390, 1996.&lt;br /&gt;
&lt;br /&gt;
[McCulloch and Pitts(1943)] W. S. McCulloch and W. Pitts. A logical calculus of ideas immanent in nervous activity. &amp;#039;&amp;#039;Bulletin of Mathematical Biophysics&amp;#039;&amp;#039;, 5, 115–133, 1943.&lt;br /&gt;
&lt;br /&gt;
[Rosenblatt(1958)] Frank Rosenblatt. The perceptron. A probabilistic model for information storage and organization in the brain. &amp;#039;&amp;#039;Psychological Reviews&amp;#039;&amp;#039;, 65, 386–408, 1958.&lt;br /&gt;
&lt;br /&gt;
[Goodfellow et al.(2016)] I. Goodfellow, Y. Bengio, and A. Courville. &amp;#039;&amp;#039;Deep Learning&amp;#039;&amp;#039;. MIT Press, 2016.&lt;br /&gt;
&lt;br /&gt;
[Reynolds(2021)] Anh Reynolds. &amp;#039;&amp;#039;Understanding convolutional neural networks (cnns).&amp;#039;&amp;#039; https://anhreynolds.com/blogs/cnn.html, 2021 Accessed: 2024-02-11.&lt;br /&gt;
&lt;br /&gt;
[JurafskyMartin(2023)] Daniel Jurafsky and James H. Martin. &amp;#039;&amp;#039;Speech and Language Processing&amp;#039;&amp;#039;. https://web.stanford.edu/ jurafsky/slp3, 2023&lt;br /&gt;
&lt;br /&gt;
[Hochreiter(1991)] S. Hochreiter. &amp;#039;&amp;#039;Untersuchungen zu dynamischen neuronalen Netzen. Diplom thesis&amp;#039;&amp;#039;. Diplom thesis, Institut f. Informatik, Technische Univ. Munich., Germany, 1991.&lt;br /&gt;
&lt;br /&gt;
[CARTPennStateCourse(2024)] Penn State’s Department of Statistics. &amp;#039;&amp;#039;Course notes for STAT 508: Applied Data Mining and Statistical Learning, Lesson 11&amp;#039;&amp;#039;. https://online.stat.psu.edu/stat508/, 2024 Creative Commons license CC BY-NC 4.0&lt;br /&gt;
&lt;br /&gt;
[Breiman(1996)] Leo Breiman. Bagging predictors. &amp;#039;&amp;#039;Machine Learning&amp;#039;&amp;#039;, 24(2), 123–140, 1996. doi:10.1007/BF00058655&lt;br /&gt;
&lt;br /&gt;
[Elman(1990)] J. L. Elman. Finding structure in time. &amp;#039;&amp;#039;Cognitive science&amp;#039;&amp;#039;, 14(2), 179–211, 1990.&lt;br /&gt;
&lt;br /&gt;
[Werbos(1974)] P. Werbos. &amp;#039;&amp;#039;Beyond regression: new tools for prediction and analysis in the behavioral sciences. Ph.D. thesis&amp;#039;&amp;#039;. Ph.D. thesis, Harvard University, USA, 1974.&lt;br /&gt;
&lt;br /&gt;
[SchusterPaliwal(1997)] M. Schuster and K. K. Paliwal. Bidirectional recurrent neural networks. &amp;#039;&amp;#039;IEEE Transactions on Signal Processing&amp;#039;&amp;#039;, 45, 2673–2681, 1997.&lt;br /&gt;
&lt;br /&gt;
[HochreiterSchmidhuber(1997)] S. Hochreiter and J. Schmidhuber. Long short-term memory. &amp;#039;&amp;#039;Neural Computation&amp;#039;&amp;#039;, 9(8),1735–1780, 1997.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[Bellman(1957)] Richard Bellman. A Markovian Decision Process. &amp;#039;&amp;#039;Journal of Mathematics and Mechanics&amp;#039;&amp;#039;, 6(5):679–684, 1957. http://www.jstor.org/stable/24900506&lt;br /&gt;
&lt;br /&gt;
[Bertsekas(1987)] Dimitri P. Bertsekas. Dynamic Programming: Deterministic and Stochastic Models. Prentice-Hall, 1987.&lt;br /&gt;
&lt;br /&gt;
[LittmanDeanKaelbling(1995)] M. L. Littman, T. L. Dean, and L. P. Kaelbling. On the complexity of solving Markov decision problems. In &amp;#039;&amp;#039;Proceedings of the Eleventh Annual Conference on Uncertainty in Articial Intelligence (UAI-95)&amp;#039;&amp;#039;, Montreal, Québec, Canada, 1995.&lt;br /&gt;
&lt;br /&gt;
[Li(2018)] Y. Li. Deep reinforcement learning. . https://arxiv.org/abs/1810.06339 arXiv:1810.06339&lt;br /&gt;
&lt;br /&gt;
[Son et al.(2022)] Ki Young Son, Jongwoo Ko, Eunseok Kim, Si Young Lee, Min-Ji Kim, Jisang Han, Eunhae Shin, Tae-Young Chung, and Dong Hui Lim. Deep learningbased cataract detection and grading from slit-lamp and retro-illumination&lt;br /&gt;
photographs: Model development and validation study.. &amp;#039;&amp;#039;Ophthalmology Science&amp;#039;&amp;#039;, 2(2), 2022.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Evaluierung_und_Verbesserung_von_AI-Modellen&amp;diff=6426</id>
		<title>Evaluierung und Verbesserung von AI-Modellen</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Evaluierung_und_Verbesserung_von_AI-Modellen&amp;diff=6426"/>
		<updated>2024-09-14T23:24:40Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;evaluierung-und-verbesserung-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Evaluierung und Verbesserung von KI-Modellen =  &amp;lt;span id=&amp;quot;evaluierung-von-klassifikations--und-regressionsmodellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; == Evaluierung von Klassifikations- und Regressionsmodellen ==  &amp;lt;span id=&amp;quot;bewertungsmetriken-zur-klassifizierung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; === Bewertungsmetriken zur Klassifizierung ===  Ein Klassifizierungsmodell wird anhand der Testdaten ausgewertet. Die zur Bewertung des Modells am…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;evaluierung-und-verbesserung-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Evaluierung und Verbesserung von KI-Modellen =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluierung-von-klassifikations--und-regressionsmodellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Evaluierung von Klassifikations- und Regressionsmodellen ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;bewertungsmetriken-zur-klassifizierung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Bewertungsmetriken zur Klassifizierung ===&lt;br /&gt;
&lt;br /&gt;
Ein Klassifizierungsmodell wird anhand der Testdaten ausgewertet. Die zur Bewertung des Modells am häufigsten verwendeten allgemeinen Bewertungsmetriken (evaluation metrics) sind wie folgt aufgeführt:&lt;br /&gt;
&lt;br /&gt;
* Accuracy (Genauigkeit),&lt;br /&gt;
* Konfusionsmatrix (confusion matrix),&lt;br /&gt;
* Precision und Recall (Präzision und Rückruf),&lt;br /&gt;
&lt;br /&gt;
Die Accuracy ist das Verhältnis der korrekt klassifizierten Beispiele zur Gesamtzahl der Beispiele im Testdaten. Definiert man wahre Beispiele (true examples - TE) und falsche Beispiele (false examples - FE) als Anzahl der korrekt und falsch klassifizierten Beispiele im Testdaten, kann die Accuracy wie folgt angegeben werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TE}{TE+FE}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Konfusionsmatrix ist eine Metrik zur Visualisierung der Klassifizierungsleistung (classification performance). Die Zeilen der Matrix stellen die wahren Klassen dar und die Spalten zeigen die vorhergesagten Klassen. Das Element (i,j) der Matrix zeigt die Anzahl der Testbeispiele, die zur Klasse i gehören und als Klasse j klassifiziert sind. Die Konfusionsmatrix zeigt also nicht nur die Anzahl der korrekt klassifizierten Beispiele für jede Klasse, sondern auch eine Vorstellung von typischen Fehlklassifizierungen, die das Modell vornimmt. Eine Beispiel-Konfusionsmatrix ist in Abbildung [[#fig:EvalMetric_1|49]] zu sehen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:EvalMetric_1&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:EvalMetric_ConfMatrExa.jpg|460px|thumb|center|Abbildung 49: Eine Beispiel-Konfusionsmatrix für ein Klassifizierungsmodell mit 3 Klassen.]] &amp;lt;span id=&amp;quot;fig:EvalMetric_1&amp;quot; label=&amp;quot;fig:EvalMetric_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Die Metriken Precision und Recall wurden ursprünglich für binäre Klassifizierungsmodelle eingeführt, ihre Verwendung kann jedoch auf Mehrklassenfälle (multiclass case) ausgeweitet werden. Daher werden sie zunächst für binäre Klassifizierungsmodelle definiert und erläutert.&lt;br /&gt;
&lt;br /&gt;
In binärer Klassifizierungsaufgabe mit positiven und negativen Klassen kann das Ergebnis der Klassifizierungsaufgabe in einen von vier Fällen eingeteilt werden: richtig/falsch (correctly/incorrectly) klassifizierte Beispiele, die zur positiven/negativen Klasse (positive/negative class) gehören. Die Vorhersage ist true positive (TP), wenn ein positives Beispiel richtig klassifiziert wird, wie z. B. das Vorhandensein einer Krankheit. Eine false negative (FN) Vorhersage tritt auf, wenn ein positives Beispiel vom Modell als zur negativen Klasse gehörend klassifiziert wird. Ebenso tritt eine true negative (TN) Vorhersage auf, wenn ein negatives Beispiel richtig klassifiziert wird. Schließlich ist die Vorhersage false positive (FP), wenn ein negatives Beispiel als zur positiven Klasse gehörend klassifiziert wird. Diese Fälle sind in Tabelle [[#tab:poss_predictions|5]] zusammengefasst.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:poss_predictions&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Mögliche Fälle des Ergebnisses der Klassifizierungsaufgabe (=Vorhersage)&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| true &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\backslash&amp;lt;/math&amp;gt; predicted  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   positive  &lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   negative&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| positive  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true positive (TP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false negative (FN)&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| negative  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;false positive (FP)&amp;lt;/span&amp;gt;  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;|   &amp;lt;span&amp;gt;true negative (TN)&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
Für den Fall der binären Klassifizierung kann die Accuracy alternativ wie folgt definiert werden: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Accuracy} = \frac{TP+TN}{TP+TN+FP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Begriffe TP, FN, TN und FP werden auch verwendet, um die Anzahl der entsprechenden Fälle zu bezeichnen, z. B. bezeichnet TP auch die Anzahl der echten positiven Ergebnisse.&lt;br /&gt;
&lt;br /&gt;
Precision ist das Verhältnis der richtig klassifizierten positiven Beispiele zur Gesamtzahl der als positiv klassifizierten Beispiele:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Precision} = \frac{TP}{TP+FP}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Im Gegensatz dazu bezeichnet der Recall das Verhältnis der richtig klassifizierten Positivbeispiele zur Gesamtzahl der Positivbeispiele: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{Recall} = \frac{TP}{TP+FN}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In einer Multi-Class-Setting werden die Metriken Precision und Recall zunächst für jede Klasse einzeln berechnet und dann gemittelt. Auf diese Weise quantifizieren sie die Gesamtklassifizierungsleistung (overall classification performance).&lt;br /&gt;
&lt;br /&gt;
Die Verwendung der verschiedenen Metriken ist in der Tabelle [[#tab:use_metrics|6]] zusammengefasst&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;tab:use_metrics&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Die Verwendung der verschiedenen Metriken.&lt;br /&gt;
|-&lt;br /&gt;
! style=&amp;quot;text-align: left;&amp;quot;| Bewertungsmetrik&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot;|   Wann verwenden?  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Accuracy  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Bei Klassifizierungsproblemen&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| mit ausgeglichenen Klassen  &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Precision  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Wenn es wichtig ist, sich der positiven Vorhersage&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| sicher zu sein, um negative Konsequenzen zu vermeiden,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| wie z.B. im Falle einer Verringerung des Kreditlimits,&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| um Unzufriedenheit beim Kunden zu vermeiden.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| Recall  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| Wenn es wichtig ist, positive Ereignisse mit&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| geringer Wahrscheinlichkeit zu erfassen, wie z.B. um&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;|  &lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot;| vorherzusagen ob eine Person krank ist oder nicht.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;evaluation-metrics-for-regression&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Evaluation metrics for regression ===&lt;br /&gt;
&lt;br /&gt;
Die am häufigsten verwendeten Metriken, die zur Bewertung von Regressionsmodellen verwendet werden, sind hier aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* Mean Squared Error - MSE (Mittlerer quadrierter Fehler),&lt;br /&gt;
* Mean Absolute Error - MAE (Mittlerer absoluter Fehler),&lt;br /&gt;
&lt;br /&gt;
Der Mean Squared Error (MSE) ist eine der grundlegenden Statistiken zur Bewertung der Qualität eines Regressionsmodells. Es handelt sich um den Durchschnitt der Quadrate der Differenz zwischen den tatsächlichen und den vorhergesagten Werten. Mit anderen Worten:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MSE} = \frac{1}{K} \sum_{k} (\hat{y}_k -  y_k)^2.&amp;lt;/math&amp;gt; Je kleiner der MSE, desto besser passt das Regressionsmodell zu den tatsächlichen Werten.&lt;br /&gt;
&lt;br /&gt;
Der Mean Absolute Error (MAE) ist die durchschnittliche absolute Differenz zwischen den tatsächlichen und den vorhergesagten Werten. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\mathrm{MAE} = \frac{1}{K}\sum_{k}|y_k - \hat{y}_k|&amp;lt;/math&amp;gt; Eine schöne Eigenschaft des MAE ist, dass er weniger wahrscheinlich von Extremwerten beeinflusst wird. Er ist ein gängiges Maß, das in der Zeitreihenanalyse (time series analysis) als Prognosefehler (forecast error) verwendet wird.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;verbesserungen-und-anpassungen-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Verbesserungen und Anpassungen von KI-Modellen ==&lt;br /&gt;
&lt;br /&gt;
Die Konstruktion eines KI-Modells ist keine triviale Aufgabe. Die häufigsten Probleme sind die folgenden.&lt;br /&gt;
&lt;br /&gt;
# Keine oder langsame Konvergenz während des Training.&lt;br /&gt;
# Unzureichende Leistung, z. B.&lt;br /&gt;
#* zu niedrige Accuracy oder&lt;br /&gt;
#* gestreute (nicht diagonal zentriert) Konfusionsmatrix.&lt;br /&gt;
&lt;br /&gt;
Diese Probleme erfordern Verbesserungen bzw. Anpassungen am KI-Modell. Nachfolgend werden die häufigsten Ursachen für keine oder langsame Konvergenz während des Trainings sowie einige mögliche Lösungsansätze für sie aufgelistet.&lt;br /&gt;
&lt;br /&gt;
* Nicht optimale Stopping Kriterium oder leistungsswäche Hardware. In dem Fall können die folgenden Anpassungen helfen.&lt;br /&gt;
** Einsetzen von Kriterium des „Early Stopping“.&lt;br /&gt;
** Einsetsen von leistungsstärkere Hardware (einschließlich Prozessor,&amp;lt;br /&amp;gt;&lt;br /&gt;
RAM und Grafikkarte).&lt;br /&gt;
* Unzureichende Optimierungsverfahren. Bei Verwendung einer unzureichenden Optimierungsmethode muss die potenziell beste Optimierungsmethode auf Grundlage früherer Erfahrungen mit Aufgaben in ähnlichen Fachgebieten ausgewählt werden. Diese Auswahl erfodert Erfahrung mit KI-Modelle und tiefes Verständnis der Aufgabe.&lt;br /&gt;
* Unzureichende Initialisierung der Parameter. Dies kann durch Ändern oder Anpassen der (heuristischen) Initialisierungsstrategie verbessert werden.&lt;br /&gt;
* Kein richtige Hyperparameter-Einstellungen (einschliesslich der Parameter von der verwendeten Optimierungsalgorithmus). Dieses Problem kann durch Ausprobieren mehrerer Hyperparameter-Einstellungen (einschliesslich Minibatch- Größe) oder Anwenden von Regularizationstechniken gelöst werden.&lt;br /&gt;
* „Vanishing Gradient Problem“ (in DL mit Anzahl von Hidden Layers in der Größenordnung von 100s). Dies ist ein bekanntes und gut eingegrenztes Problem, welches durch die Verwendung eines etablierten Ansatzes, der zum KI-Modell passt, vermieden werden. (Etablierte Ansätze befinden sich unter [https://en.wikipedia.org/wiki/Vanishing_gradient_problem Vanishing_gradient_problem])&lt;br /&gt;
&lt;br /&gt;
Eine unvollständige Liste möglicher Ursachen für unzureichende Leistung auf Testdaten und einige mögliche Lösungsansätze für sie sind nachstehend aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* Underfitting. Um Underfitting zu vermeiden, müssen die Größe der Trainingsdaten erhöht werden.&lt;br /&gt;
* Overfitting. Es gibt mehrere Techniken um Overfitting zu reduzieren. Einige sind wie folgt aufgelistet.&lt;br /&gt;
** Verwenden größerer Trainingsdaten.&lt;br /&gt;
** Verwenden von Methoden wie Bootstrap-Aggregation oder Random Forest um die Varianz neben gleichem Bias zum reduzieren.&lt;br /&gt;
** Verwenden von Dropout Layer - in CNN Modellen.&lt;br /&gt;
* Class Imbalance: die Trainingsdaten sind ungleichmäßig auf die Klassen verteilt. Diese wirkt sich negativ auf die Leistung der CNN-Klassifizierung aus [Son et al.(2022)]. Das Problem von Class Imbalance kann gelöst werden, indem die Größe der Trainingsdaten für jede Klasse ausgeglichen wird. Dies kann auf verschiedene Weise erreicht werden, wie z.B.&lt;br /&gt;
** Verwenden zusätzlicher Trainingsbeispiele,&lt;br /&gt;
** Zusammenführen von Trainingsdaten aus mehreren Klassen oder&lt;br /&gt;
* Nicht optimale Hyperparameter-Einstellungen. Siehe oben beim Ursachen von keiner oder langsamer Konvergenz während des Trainings.&lt;br /&gt;
* Nicht optimale Initialisierung der Parameter. Siehe oben beim Ursachen von keiner oder langsamer Konvergenz während des Trainings.&lt;br /&gt;
* Inadäquate KI-Modell. Das Design des geegneten KI-Modells erfolgt normalerweisse iterative. Jeder Schritt zur Verbesserung des KI-Modells führt zu einem besseren Verständnis der Aufgabe. Der Design von komplexerer KI-Modell/DL-Architektur efordert ein hohes Maß an Erfahrung mit KI-Modellen/DL-Architekturen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;stärken-und-schwächen-von-ki-modellen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Stärken und Schwächen von KI-Modellen ==&lt;br /&gt;
&lt;br /&gt;
KI-Modelle haben wie alle technischen Lösungen Stärken und Schwächen.&lt;br /&gt;
&lt;br /&gt;
Einige der Stärken von KI-Modellen können wie folgt aufgelistet werden.&lt;br /&gt;
&lt;br /&gt;
# Eine ihre größte Stärke ist ihre Generalisierungsfähigkeit. ML-Algorithmen können ihren Aufgaben auch mit unbekannten Eingabebeispielen gut ausführen.&lt;br /&gt;
# KI-Modelle sind in der Lage, ihre Leistung für eine bestimmte Aufgabe durch zusätzliche Trainingsdaten zu verbessern.&lt;br /&gt;
# Sie können viele Aufgaben realisieren, die auf eine oder Kombination von mehreren der folgenden Intelligenz fordernden Aufgaben zurückgeführt werden können: Regression, Klassifizierung, Representation Learning und optimale Kontrolle.&lt;br /&gt;
# Sie haben eine sehr breite Anwendbarkeit: mit KI-Modellen können neue Anwendungen praktisch in allen möglichen Anwendungsbereichen implementiert werden.&lt;br /&gt;
# In den meisten Anwendungsfällen sind sie schneller als Menschen.&lt;br /&gt;
# Bei einigen Aufgaben sind sie leistungsfähiger (z. B. bei der Genauigkeit von Klassifizierungsaufgaben) als die menschliche Intelligenz.&lt;br /&gt;
&lt;br /&gt;
Nachfolgend befindet sich eine unvollständige Liste der Schwächen von KI-Modellen.&lt;br /&gt;
&lt;br /&gt;
# Enige KI-Modelle (z.B. NNs) sind als Black Box zu sehen, d.h. ihre Arbeitsweise ist nicht gut genug verstanden.&lt;br /&gt;
# Alle KI-Modelle machen eventuell Fehler z.B. bei Klassifikationsaufgaben.&lt;br /&gt;
# Indem sie potenziell fehlerhafte Ergebnisse produzieren, werfen sie ethische Fragen auf.&lt;br /&gt;
# Da sie potenziell fehlerhafte Ergebnisse produzieren, können sie nicht zur Entscheidungsfindung verwendet werden, sondern nur für Assistenzanwendungen.&lt;br /&gt;
# KI-Modelle sind nicht universell, der Anwendungsbereich jedes KI-Algorithmus ist spezifisch, d. h. jeder KI-Algorithmus hat einen begrenzten Anwendungsbereich.&lt;br /&gt;
# Heutige KI-Modelle können viele Fähigkeiten der menschlichen Intelligenz nicht ausführen (wie Abstraktion, Konzepterstellung, analytisches Denken usw.).&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Reinforcement_Learning&amp;diff=6425</id>
		<title>Reinforcement Learning</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Reinforcement_Learning&amp;diff=6425"/>
		<updated>2024-09-14T23:20:01Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;reinforcement-learning&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Reinforcement Learning =&lt;br /&gt;
&lt;br /&gt;
Reinforcement Learning - RL (Bestärkendes Lernen oder Verstärkungslernen) ist ein agentenbasierter ML Ansatz. Ein Agent passt seine Aktionen iterativ entsprechend dem Feedback der Umgebung an, um sein Ziel zu erreichen. Dieser Mechanismus kommt in vielen biologischen Systemen vor und ist typisch für Kontrollaufgaben. Dieser auf iterativer Bewertung basierende Mechanismus findet jedoch auch bei vielen anderen Aufgaben aus anderen Anwendungsbereichen, da er ein Optimierungsproblem realisiert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;kurze-beschreibung-von-reinforcement-learning-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Kurze Beschreibung von Reinforcement Learning (RL) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;problemstellung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Problemstellung ===&lt;br /&gt;
&lt;br /&gt;
Die Zeit wird als diskrete Zeit modelliert, d. h. sie verläuft in Zeitschritten (time steps). Der RL-Agent befindet sich zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in einem Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t&amp;lt;/math&amp;gt; , wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t \in \mathcal{S}&amp;lt;/math&amp;gt;. Der Agent führt eine Aktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_t \in \mathcal{A}&amp;lt;/math&amp;gt; aus den erlaubten Aktionen im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t&amp;lt;/math&amp;gt; aus. Als Reaktion der Umgebung auf diese Aktion erhält der Agent eine Belohnung (reward) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r_t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r_t \in \mathcal{R}&amp;lt;/math&amp;gt; und der Zustand des Agenten ändert sich im nächsten Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t+1&amp;lt;/math&amp;gt; zu &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; . Der Begriff „Umgebung“ wird im weitesten Sinne verwendet, was bedeutet, dass die Umgebung alles sein kann, was auf die Aktionen eines Agenten reagiert. Das Ziel des RL-Agenten wird durch die Maximierung der akkumulierten (erwarteten) Belohnungen (accumulated expected reward) in der Zukunft modelliert, wobei der Wertverlust der Belohnungen (depreciation of rewards) im Laufe der Zeit berücksichtigt wird. Dies erfolgt auf die in der Wirtschaftswissenschaft übliche Methode durch die Anwendung von Abzinsungsfaktoren (discount factors). Auf diese Weise erreicht der RL-Agent sein Ziel, indem er durch iterative Auswertungen der Reaktionen der Umgebung auf seine Aktionen eine Folge von Aktionen festlegt.&lt;br /&gt;
&lt;br /&gt;
Die Interaktion mit der Umgebung wird durch die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s_t,a_t)&amp;lt;/math&amp;gt; und die Zustandsänderungen durch Zustandsübergangswahrscheinlichkeiten&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s_{t+1}|s_t,a_t)&amp;lt;/math&amp;gt; beschrieben. Die RL-Literatur hinsichtlich des Zusammenhangs der unmittelbaren Belohnung zur Zeit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t+1&amp;lt;/math&amp;gt; nicht einheitlich ist. Während der gesamten Diskussion von RL übernehmen wir die Assoziation der unmittelbaren Belohnung zum Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;. Somit wird die diskontierte, akkumulierte Belohnung im Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in N^+&amp;lt;/math&amp;gt; durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R_t = \sum_{\tau = 0}^{\infty} \gamma^{\tau} r_{t+\tau}&amp;lt;/math&amp;gt; ausgedrückt, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma \in (0,1]&amp;lt;/math&amp;gt; der Abzinsungsfaktor ist. Das Verhalten des Agenten wird durch die Wahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; charakterisiert. Sie beschreiben, welche Aktion mit welcher Wahrscheinlichkeit in jedem Zustand durchgeführt wird. Dies bestimmt auch die vom Agenten befolgte Policy, für die die Notation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; verwendet wird. Dann das Ziel des Agenenten kann als ein Optimierungsproblem, wie folgt,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg\max_{\pi} E[R_t|s_t, \pi]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
formuliert werden, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E[]&amp;lt;/math&amp;gt; für die Erwartung steht. Die Erwartung bezieht im obigen Ausdruck auf alle zufälligen Komponenten der bedingten diskontierten, akkumulierten ermäßigten Belohnung, gegeben der Startzustand und die Policy. Basierend auf der obigen Optimierungsformulierung kann das Ziel des Agenten auch darin ausgedrückt werden, die optimale Policy zu finden, die zu der maximal erwarteten diskontierten, akkumulierten zukünftigen Belohnung führt.&lt;br /&gt;
&lt;br /&gt;
Wir haben den RL Ansatz in diskreten Räumen (discrete spaces) erklärt, er kann aber auch auf kontinuierliche Zustands- und Aktionsräume (continuous state and action spaces) erweitert werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elemente-von-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Elemente von RL ===&lt;br /&gt;
&lt;br /&gt;
Die typischen Elemente eines RL Ansatzes sind:&lt;br /&gt;
&lt;br /&gt;
# das Modell (model),&lt;br /&gt;
# die Strategy (policy),&lt;br /&gt;
# die Wertfunktion (value function) und&lt;br /&gt;
# die Aktionswertfunktion (action value function).&lt;br /&gt;
&lt;br /&gt;
Das Modell beschreibt die Umgebungsdynamik und wird durch die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; und die Übergangswahrscheinlichkeiten der Zuständen&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; gegeben. Alternativ kann es in kompakter Form durch die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;},r|s,a)&amp;lt;/math&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
Die Policy beschreibt das langfristige Verhalten, das der Agent während seiner Interaktion mit der Umgebung im Laufe der Zeit verfolgt. Im Allgemeinen ist die Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; eine Abbildung, die jedem Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; die Wahrscheinlichkeitsverteilung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; zuweist , d. h. die Policy wird durch die Aktionswahrscheinlichkeiten spezifiziert, die die Wahrscheinlichkeit des Ausführens einer Aktion in einem bestimmten Zustand charakterisieren. Im Falle einer deterministischen Policy wird jedem Zustand nur eine Aktion zugewiesen. Für diesen Fall verwenden wir die Funktionsnotation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = \pi(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Wertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die (Zustands-)Wertfunktion gibt die erwartete diskontierte, akkumulierte zukünftige Belohnung unter Berücksichtigung des tatsächlichen Zustands und der Policy an. Aufgrund der Erwartung handelt es sich um eine Art Vorhersage der künftig angesammelten Belohnung. Die Wertfunktion hängt vom Ausgangszustand und der angewendeten Policy ab. Diese werden auch in seinen Notationen ausgedrückt: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s)&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s)&amp;lt;/math&amp;gt;. Basierend auf der obigen Definition kann es formal durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V_{\pi}(s) = E[R_t|s_t=s, \pi]&amp;lt;/math&amp;gt; gegeben sein.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Aktionswertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In ähnlicher Weise gibt die Aktionswertfunktion die erwartete diskontierte, akkumulierte zukünftige Belohnung an, jedoch neben dem Anfangszustand und der Policy auch als Abhängigkeit von der Anfangsaktion. Es wird mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q_{\pi}(s,a)&amp;lt;/math&amp;gt; oder einfach &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(s,a)&amp;lt;/math&amp;gt; bezeichnet und ist formal durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q_{\pi}(s,a) = E[R_t|s_t=s, a_t=a, \pi]&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Bellman-Gleichungen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sowohl die Wertfunktion als auch die Aktionswertfunktion können rekursiv über die möglichen Zustandsübergänge ausgedrückt werden. Diese werden durch die Bellman-Gleichungen wie folgt angegeben&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
V_{\pi}(s) &amp;amp;= \sum_{a \in \mathcal{A}} p(a|s) \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma V_{\pi}(s^{&amp;#039;}) \right)  \\&lt;br /&gt;
&amp;amp;= \sum_{a \in \mathcal{A}} p(a|s) \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a)  V_{\pi}(s^{&amp;#039;}) \right), \\&lt;br /&gt;
Q_{\pi}(s,a) &amp;amp;=  \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma \sum_{a^{&amp;#039;} \in \mathcal{A}} p(a^{&amp;#039;}|s^{&amp;#039;}) Q_{\pi}(s^{&amp;#039;}, a^{&amp;#039;}) \right) \\&lt;br /&gt;
&amp;amp;= r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) \sum_{a^{&amp;#039;} \in \mathcal{A}}  p(a^{&amp;#039;}|s^{&amp;#039;})  Q_{\pi}(s^{&amp;#039;}, a^{&amp;#039;}) .&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Diese rekursiven Gleichungen können als Zerlegungen (decompositions) betrachtet werden und als Grundlage für Lösungsalgorithmen für RL, wie dynamische Programmierung (dynamic programming) dienen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Wertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die optimale Wertfunktion ist der maximale Wert, der über alle mögliche Policy erreicht werden kann. Anders ausgedrückt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V^*(s) = \max_{\pi} V_{\pi}(s).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Auch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; kann auf rekursive Weise ausgedrückt werden, was durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
V^*(s) &amp;amp;= \max_{a} \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma V^*(s^{&amp;#039;}) \right)  \\&lt;br /&gt;
&amp;amp;= \max_{a}  \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a) V^*(s^{&amp;#039;}) \right) &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gegeben werden kann.&lt;br /&gt;
&lt;br /&gt;
Dies ist ebenfalls eine Bellman-Gleichung. Der Ausdruck von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; beinhaltet implizit, dass zunächst (im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;) die beste Aktion ausgeführt wird. Dies liegt daran, dass die gewichtete Summe in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s)&amp;lt;/math&amp;gt; mit Wahrscheinlichkeitsgewichten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt; kann als Interpolation interpretiert werden, weil &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{a \in \mathcal{A}} p(a|s) = 1&amp;lt;/math&amp;gt;. Daher ist das Maximum der gewichteten Summe der höchste Wert in der Summe mit dem Wahrscheinlichkeitsgewicht &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. Dies bedeutet, dass das Ergreifen der besten Maßnahme zunächst impliziert, dass die resultierende optimale Policy deterministisch ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Aktionswertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ebenso ist die optimale Aktionswertfunktion der maximale Aktionswert, der über alle mögliche Startegie erreicht werden kann. Somit ist es durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q^*(s,a) = \max_{\pi} Q_{\pi}(s, a)&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
Beobachte, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; der Wert ist, bei dem zunächst die beste Aktion durchgeführt wurde. Daraus folgt, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V^*(s) = \max_{a} Q^*(s,a) &amp;lt;/math&amp;gt; in Beziehung gesetzt werden kann.&lt;br /&gt;
&lt;br /&gt;
Die Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; kann wie folgt angegeben werden: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
Q^*(s,a) &amp;amp;= \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma \max_{a^{&amp;#039;}} Q^*(s^{&amp;#039;}, a^{&amp;#039;}) \right) \\&lt;br /&gt;
&amp;amp;= r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) \max_{a^{&amp;#039;}}  Q^*(s^{&amp;#039;}, a^{&amp;#039;}) . &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Auch hier wird zunächst die beste Aktion ausgeführt, jetzt im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s^{&amp;#039;}&amp;lt;/math&amp;gt;, da dies der erste Zustand ist, in dem eine Aktion ausgewählt werden muss (die Aktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; ist bereits gegeben).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Policy&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die optimale (deterministische) Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^*(s)&amp;lt;/math&amp;gt; kann aus der optimalen Aktionswertfunktion als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\pi^*(s) = \arg \max_{a} Q^*(s,a) &amp;lt;/math&amp;gt; erhalten werden.&lt;br /&gt;
&lt;br /&gt;
Die optimale Policy kann auch aus der optimalen Wertfunktion berechnet werden, indem zunächst die optimale Aktionswertfunktion aus der optimalen Wertfunktion berechnet wird. Dies führt zu &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q^*(s,a) = r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V^*(s^{&amp;#039;}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;methodentypen-von-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Methodentypen von RL ==&lt;br /&gt;
&lt;br /&gt;
Es gibt zwei Arten von Methoden zur Lösung eines RL Problems:&lt;br /&gt;
&lt;br /&gt;
* Modellbasierte Methoden (model-based methods)&lt;br /&gt;
* Modellfreie Methoden (model-free methods)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modellbasierte-methoden&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modellbasierte Methoden ===&lt;br /&gt;
&lt;br /&gt;
Wenn das RL Modell die Markov-Eigenschaft erfüllt, d. h. die zukünftige Entwicklung der Zustände und Aktionen nur vom tatsächlichen Zustand abhängt, kann das RL Problem als Markov Entscheidungsprozess (MDP) formuliert werden.&lt;br /&gt;
&lt;br /&gt;
Wenn der Status des Prozesses nach jedem Intervall der Länge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; zurückgesetzt wird, dann ist das MDP episodisch mit einer Episode der Länge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt;. Eine Trajectory (oder Rollout) ist eine Verwirklichung der Abfolge von Zuständen, Aktionen und Belohnungen in einer Episode. In diesem Fall wird die kumulierte ermäßigte Prämie &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R = \sum_{t = 0}^{T-1} \gamma^{t} r_{t}&amp;lt;/math&amp;gt; gegeben. Im nicht-episodischen MDP &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T=\infty&amp;lt;/math&amp;gt;. In diesem Fall stellt die Einstellung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; die Endlichkeit der diskontierten, akkumulierten Belohnung sicher.&lt;br /&gt;
&lt;br /&gt;
Wenn das Modell gegeben ist, sind die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; und die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; bekannt. Daher kann der rekursive Charakter der Bellman-Gleichungen genutzt werden. Dies ermöglicht die Erstellung von Algorithmen mithilfe dynamischer Programmierung. Die beiden wichtigsten modellbasierten Algorithmen sind&lt;br /&gt;
&lt;br /&gt;
* Value Iteration und&lt;br /&gt;
* Policy Iteration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Value iteration&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Wertfunktion kann iterativ für alle Zustände aus der Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt;, kombiniert mit der Beziehung zwischen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt;, berechnet werden. Dies ist die Basis für den Value Iteration Algorithmus. Der Pseudocode des Algorithmus wird in Algorithm  dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm  Value iteration&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Eingabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;,&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s, s^{&amp;#039;} \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Ausgabe: die optimale Wertfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisierung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s)&amp;lt;/math&amp;gt; mit einer beliebigen nicht negativen Funktion&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Wenn das Stoppkriterium NICHT erfüllt ist&amp;lt;br /&amp;gt;&lt;br /&gt;
3   for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4     for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5       &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(s,a) = r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V(s^{&amp;#039;})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6     end&amp;lt;br /&amp;gt;&lt;br /&gt;
7     &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s^{&amp;#039;})= \max_{a^{&amp;#039;}}  Q(s^{&amp;#039;}, a^{&amp;#039;})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   end&amp;lt;br /&amp;gt;&lt;br /&gt;
9 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Es kann gezeigt werden, dass der Algorithmus immer gegen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
([Bellman(1957)], [Bertsekas(1987)]) konvergiert. Die optimale Policy kann aus dem berechneten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; bestimmt werden. Dies ist ein Greedy Algorithmus, da &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; in jeder Iteration basierend auf der besten Aktion in jedem Zustand bestimmt wird. Allgemeiner gesagt ist ein Algorithmus Greedy, wenn in jedem Iterationsschritt die Eingabe für die nächste Iteration als die (in gewisser Weise) beste Ausgabe des tatsächlichen Iterationsschritts bestimmt wird. Ein wirksames Stoppkriterium besteht darin, zu iterieren, bis die maximale Differenz zwischen zwei aufeinanderfolgenden Wertfunktionen kleiner als ein vorgeschriebener kleiner &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;-Wert ist.&lt;br /&gt;
&lt;br /&gt;
Die numerische Komplexität des Algorithmus beträgt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{S}|^2 |\mathcal{A}| I)&amp;lt;/math&amp;gt;, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;I&amp;lt;/math&amp;gt; die Anzahl der erforderlichen Iterationen ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Policy Iteration&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bei der Value Iteration wird die optimale Policy indirekt aus der optimalen Wertfunktion ermittelt. Im Policy Iteration Algorithmus wird die Policy direkt in jedem Iterationsschritt berechnet. Die iterative Berechnung der Policy kann direkt erfolgen, indem eine Gleichung verwendet wird, die wiederum aus der Kombination der Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; mit der Beziehung zwischen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; erhalten wird. Dies führt zu&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\pi^*(s) = \arg \max_{a} \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V_{\pi^*}^*(s^{&amp;#039;}) \right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die rekursive Berechnung der nächsten Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}&amp;lt;/math&amp;gt; basierend auf der obigen Gleichung erfordert die Berechnung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; für jedes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s^{&amp;#039;} \in \mathcal {S}&amp;lt;/math&amp;gt; aus der tatsächlichen Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi(s)&amp;lt;/math&amp;gt;. Dies kann erreicht werden, indem die Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; auf die Bellman-Gleichungen der Wertfunktion angewendet und für die Werte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; gelöst wird. Sie bilden ein lineares Gleichungssystem, da sie keine Maximaloperation beinhalten. Das Zusammenfügen all dieser Punkte ergibt den Policy Iteration Algorithmus. Der Pseudocode des Algorithmus wird in Algorithm  angezeigt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm  Policy iteration&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Eingabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;,&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s, s^{&amp;#039;} \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Ausgabe: die optimale Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^*(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Auswählen eine beliebige Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}(s)&amp;lt;/math&amp;gt; und Einstellen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi \neq \pi^{&amp;#039;}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;} \neq \pi&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi = \pi^{&amp;#039;}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Berechnen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; aus der Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt;, durch Lösung eines linearen Gleichungssystems lösen&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s) = \left(r(s,\pi(s)) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a)    V_{\pi}(s^{&amp;#039;}) \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 Aktualisieren die Policy als&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}(s) = \arg \max_{a} \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V_{\pi}(s^{&amp;#039;})\right)&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Das Aktualisieren der Policy bedeutet, die beste erste Aktion anstelle der zuvor von der Policy verwendeten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi(s)&amp;lt;/math&amp;gt; zu bestimmen. Wenn sie unterschiedlich sind, verbessert die Änderung der ersten Aktion strikt die Wertfunktion (der Wert mit der besten Aktion ist aufgrund von max besser als mit der vorherigen Aktion) und damit auch die Policy. Wenn in der Policy keine Aktion geändert werden, ist keine Verbesserung möglich und die Policy ist somit optimal. Die Anzahl der Iterationen ist mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{S}|&amp;lt;/math&amp;gt; höchstens exponentiell, da die Anzahl der verschiedenen Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{A}|^{|\mathcal{S}|}&amp;lt;/math&amp;gt; beträgt. Die Anzahl der Operationen ist jedoch pseudopolynomiell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modellfreie-methoden&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modellfreie Methoden ===&lt;br /&gt;
&lt;br /&gt;
Wenn kein MDP vorhanden ist, da die Zustände nicht vollständig beobachtbar (fully observable) sind, können in einigen Fällen andere Modelle etabliert werden. Bei MDP stellt die Markov-Eigenschaft sicher, dass die Zustände vollständig beobachtbar sind. Dies ist jedoch nicht immer realistisch. Wenn die Zustände nicht vollständig beobachtbar sind, dann können in einigen Fällen die teilweise beobachtbaren MDPs (partially observable MDPs - POMDPs) ermittelt werden, die die Verallgemeinerung der MDPs darstellen.&lt;br /&gt;
&lt;br /&gt;
Wenn kein Modell vorhanden ist oder das Modell nicht bekannt ist, können modellfreie Methoden verwendet werden. Sie funktionieren auch, wenn es ein MDP-Modell oder ein anderes Modell als MDP, die teilweise beobachtbaren MDPs oder das Multiarmed-Bandit-Modell vorhanden ist.&lt;br /&gt;
&lt;br /&gt;
Zu den wichtigsten modellfreien Algorithmen gehören:&lt;br /&gt;
&lt;br /&gt;
* Temporal Difference (TD) Learning + Bootstrapping&lt;br /&gt;
* Q-Learning (einschließlich SARSA)&lt;br /&gt;
* Function approximation (Funktionsnäherung)&lt;br /&gt;
* Policy Based Methoden (Policy-basierte Methoden) oder Policy Optimization&lt;br /&gt;
&lt;br /&gt;
Weitere Einzelheiten zu modellfreien RL-Methoden können in [Li(2018)] gefunden werden.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Reinforcement_Learning&amp;diff=6424</id>
		<title>Reinforcement Learning</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Reinforcement_Learning&amp;diff=6424"/>
		<updated>2024-09-14T23:15:15Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: Die Seite wurde neu angelegt: „&amp;lt;span id=&amp;quot;reinforcement-learning&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; = Reinforcement Learning =  Reinforcement Learning - RL (Bestärkendes Lernen oder Verstärkungslernen) ist ein agentenbasierter ML Ansatz. Ein Agent passt seine Aktionen iterativ entsprechend dem Feedback der Umgebung an, um sein Ziel zu erreichen. Dieser Mechanismus kommt in vielen biologischen Systemen vor und ist typisch für Kontrollaufgaben. Dieser auf iterativer Bewertung basierende Mechanismus findet jedoc…“&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;reinforcement-learning&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Reinforcement Learning =&lt;br /&gt;
&lt;br /&gt;
Reinforcement Learning - RL (Bestärkendes Lernen oder Verstärkungslernen) ist ein agentenbasierter ML Ansatz. Ein Agent passt seine Aktionen iterativ entsprechend dem Feedback der Umgebung an, um sein Ziel zu erreichen. Dieser Mechanismus kommt in vielen biologischen Systemen vor und ist typisch für Kontrollaufgaben. Dieser auf iterativer Bewertung basierende Mechanismus findet jedoch auch bei vielen anderen Aufgaben aus anderen Anwendungsbereichen, da er ein Optimierungsproblem realisiert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;kurze-beschreibung-von-reinforcement-learning-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Kurze Beschreibung von Reinforcement Learning (RL) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;problemstellung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Problemstellung ===&lt;br /&gt;
&lt;br /&gt;
Die Zeit wird als diskrete Zeit modelliert, d. h. sie verläuft in Zeitschritten (time steps). Der RL-Agent befindet sich zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; in einem Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t&amp;lt;/math&amp;gt; , wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t \in \mathcal{S}&amp;lt;/math&amp;gt;. Der Agent führt eine Aktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_t \in \mathcal{A}&amp;lt;/math&amp;gt; aus den erlaubten Aktionen im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_t&amp;lt;/math&amp;gt; aus. Als Reaktion der Umgebung auf diese Aktion erhält der Agent eine Belohnung (reward) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r_t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r_t \in \mathcal{R}&amp;lt;/math&amp;gt; und der Zustand des Agenten ändert sich im nächsten Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t+1&amp;lt;/math&amp;gt; zu &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; . Der Begriff „Umgebung“ wird im weitesten Sinne verwendet, was bedeutet, dass die Umgebung alles sein kann, was auf die Aktionen eines Agenten reagiert. Das Ziel des RL-Agenten wird durch die Maximierung der akkumulierten (erwarteten) Belohnungen (accumulated expected reward) in der Zukunft modelliert, wobei der Wertverlust der Belohnungen (depreciation of rewards) im Laufe der Zeit berücksichtigt wird. Dies erfolgt auf die in der Wirtschaftswissenschaft übliche Methode durch die Anwendung von Abzinsungsfaktoren (discount factors). Auf diese Weise erreicht der RL-Agent sein Ziel, indem er durch iterative Auswertungen der Reaktionen der Umgebung auf seine Aktionen eine Folge von Aktionen festlegt.&lt;br /&gt;
&lt;br /&gt;
Die Interaktion mit der Umgebung wird durch die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s_t,a_t)&amp;lt;/math&amp;gt; und die Zustandsänderungen durch Zustandsübergangswahrscheinlichkeiten&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s_{t+1}|s_t,a_t)&amp;lt;/math&amp;gt; beschrieben. Die RL-Literatur hinsichtlich des Zusammenhangs der unmittelbaren Belohnung zur Zeit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t+1&amp;lt;/math&amp;gt; nicht einheitlich ist. Während der gesamten Diskussion von RL übernehmen wir die Assoziation der unmittelbaren Belohnung zum Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;. Somit wird die diskontierte, akkumulierte Belohnung im Zeitschritt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in N^+&amp;lt;/math&amp;gt; durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R_t = \sum_{\tau = 0}^{\infty} \gamma^{\tau} r_{t+\tau}&amp;lt;/math&amp;gt; ausgedrückt, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma \in (0,1]&amp;lt;/math&amp;gt; der Abzinsungsfaktor ist. Das Verhalten des Agenten wird durch die Wahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; charakterisiert. Sie beschreiben, welche Aktion mit welcher Wahrscheinlichkeit in jedem Zustand durchgeführt wird. Dies bestimmt auch die vom Agenten befolgte Policy, für die die Notation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; verwendet wird. Dann das Ziel des Agenenten kann als ein Optimierungsproblem, wie folgt,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg\max_{\pi} E[R_t|s_t, \pi]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
formuliert werden, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E[]&amp;lt;/math&amp;gt; für die Erwartung steht. Die Erwartung bezieht im obigen Ausdruck auf alle zufälligen Komponenten der bedingten diskontierten, akkumulierten ermäßigten Belohnung, gegeben der Startzustand und die Policy. Basierend auf der obigen Optimierungsformulierung kann das Ziel des Agenten auch darin ausgedrückt werden, die optimale Policy zu finden, die zu der maximal erwarteten diskontierten, akkumulierten zukünftigen Belohnung führt.&lt;br /&gt;
&lt;br /&gt;
Wir haben den RL Ansatz in diskreten Räumen (discrete spaces) erklärt, er kann aber auch auf kontinuierliche Zustands- und Aktionsräume (continuous state and action spaces) erweitert werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;elemente-von-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Elemente von RL ===&lt;br /&gt;
&lt;br /&gt;
Die typischen Elemente eines RL Ansatzes sind:&lt;br /&gt;
&lt;br /&gt;
# das Modell (model),&lt;br /&gt;
# die Strategy (policy),&lt;br /&gt;
# die Wertfunktion (value function) und&lt;br /&gt;
# die Aktionswertfunktion (action value function).&lt;br /&gt;
&lt;br /&gt;
Das Modell beschreibt die Umgebungsdynamik und wird durch die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; und die Übergangswahrscheinlichkeiten der Zuständen&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; gegeben. Alternativ kann es in kompakter Form durch die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;},r|s,a)&amp;lt;/math&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
Die Policy beschreibt das langfristige Verhalten, das der Agent während seiner Interaktion mit der Umgebung im Laufe der Zeit verfolgt. Im Allgemeinen ist die Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; eine Abbildung, die jedem Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; die Wahrscheinlichkeitsverteilung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; zuweist , d. h. die Policy wird durch die Aktionswahrscheinlichkeiten spezifiziert, die die Wahrscheinlichkeit des Ausführens einer Aktion in einem bestimmten Zustand charakterisieren. Im Falle einer deterministischen Policy wird jedem Zustand nur eine Aktion zugewiesen. Für diesen Fall verwenden wir die Funktionsnotation &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a = \pi(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Wertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die (Zustands-)Wertfunktion gibt die erwartete diskontierte, akkumulierte zukünftige Belohnung unter Berücksichtigung des tatsächlichen Zustands und der Policy an. Aufgrund der Erwartung handelt es sich um eine Art Vorhersage der künftig angesammelten Belohnung. Die Wertfunktion hängt vom Ausgangszustand und der angewendeten Policy ab. Diese werden auch in seinen Notationen ausgedrückt: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s)&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s)&amp;lt;/math&amp;gt;. Basierend auf der obigen Definition kann es formal durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V_{\pi}(s) = E[R_t|s_t=s, \pi]&amp;lt;/math&amp;gt; gegeben sein.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Aktionswertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In ähnlicher Weise gibt die Aktionswertfunktion die erwartete diskontierte, akkumulierte zukünftige Belohnung an, jedoch neben dem Anfangszustand und der Policy auch als Abhängigkeit von der Anfangsaktion. Es wird mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q_{\pi}(s,a)&amp;lt;/math&amp;gt; oder einfach &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(s,a)&amp;lt;/math&amp;gt; bezeichnet und ist formal durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q_{\pi}(s,a) = E[R_t|s_t=s, a_t=a, \pi]&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Bellman-Gleichungen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sowohl die Wertfunktion als auch die Aktionswertfunktion können rekursiv über die möglichen Zustandsübergänge ausgedrückt werden. Diese werden durch die Bellman-Gleichungen wie folgt angegeben&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
V_{\pi}(s) &amp;amp;= \sum_{a \in \mathcal{A}} p(a|s) \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma V_{\pi}(s^{&amp;#039;}) \right)  \\&lt;br /&gt;
&amp;amp;= \sum_{a \in \mathcal{A}} p(a|s) \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a)  V_{\pi}(s^{&amp;#039;}) \right), \\&lt;br /&gt;
Q_{\pi}(s,a) &amp;amp;=  \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma \sum_{a^{&amp;#039;} \in \mathcal{A}} p(a^{&amp;#039;}|s^{&amp;#039;}) Q_{\pi}(s^{&amp;#039;}, a^{&amp;#039;}) \right) \\&lt;br /&gt;
&amp;amp;= r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) \sum_{a^{&amp;#039;} \in \mathcal{A}}  p(a^{&amp;#039;}|s^{&amp;#039;})  Q_{\pi}(s^{&amp;#039;}, a^{&amp;#039;}) .&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Diese rekursiven Gleichungen können als Zerlegungen (decompositions) betrachtet werden und als Grundlage für Lösungsalgorithmen für RL, wie dynamische Programmierung (dynamic programming) dienen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Wertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die optimale Wertfunktion ist der maximale Wert, der über alle mögliche Policy erreicht werden kann. Anders ausgedrückt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V^*(s) = \max_{\pi} V_{\pi}(s).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Auch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; kann auf rekursive Weise ausgedrückt werden, was durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
V^*(s) &amp;amp;= \max_{a} \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma V^*(s^{&amp;#039;}) \right)  \\&lt;br /&gt;
&amp;amp;= \max_{a}  \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a) V^*(s^{&amp;#039;}) \right) &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gegeben werden kann.&lt;br /&gt;
&lt;br /&gt;
Dies ist ebenfalls eine Bellman-Gleichung. Der Ausdruck von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; beinhaltet implizit, dass zunächst (im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt;) die beste Aktion ausgeführt wird. Dies liegt daran, dass die gewichtete Summe in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s)&amp;lt;/math&amp;gt; mit Wahrscheinlichkeitsgewichten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(a|s)&amp;lt;/math&amp;gt; kann als Interpolation interpretiert werden, weil &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{a \in \mathcal{A}} p(a|s) = 1&amp;lt;/math&amp;gt;. Daher ist das Maximum der gewichteten Summe der höchste Wert in der Summe mit dem Wahrscheinlichkeitsgewicht &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt;. Dies bedeutet, dass das Ergreifen der besten Maßnahme zunächst impliziert, dass die resultierende optimale Policy deterministisch ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Aktionswertfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ebenso ist die optimale Aktionswertfunktion der maximale Aktionswert, der über alle mögliche Startegie erreicht werden kann. Somit ist es durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q^*(s,a) = \max_{\pi} Q_{\pi}(s, a)&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
Beobachte, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; der Wert ist, bei dem zunächst die beste Aktion durchgeführt wurde. Daraus folgt, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;V^*(s) = \max_{a} Q^*(s,a) \label{opV_opQ}&amp;lt;/math&amp;gt; in Beziehung gesetzt werden kann.&lt;br /&gt;
&lt;br /&gt;
Die Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; kann wie folgt angegeben werden: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
Q^*(s,a) &amp;amp;= \sum_{s^{&amp;#039;} \in \mathcal{S}, r \in \mathcal{R}}  p(s^{&amp;#039;},r|s,a) \left(r + \gamma \max_{a^{&amp;#039;}} Q^*(s^{&amp;#039;}, a^{&amp;#039;}) \right) \\&lt;br /&gt;
&amp;amp;= r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) \max_{a^{&amp;#039;}}  Q^*(s^{&amp;#039;}, a^{&amp;#039;}) . &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Auch hier wird zunächst die beste Aktion ausgeführt, jetzt im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s^{&amp;#039;}&amp;lt;/math&amp;gt;, da dies der erste Zustand ist, in dem eine Aktion ausgewählt werden muss (die Aktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a&amp;lt;/math&amp;gt; im Zustand &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; ist bereits gegeben).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Policy&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die optimale (deterministische) Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^*(s)&amp;lt;/math&amp;gt; kann aus der optimalen Aktionswertfunktion als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\pi^*(s) = \arg \max_{a} Q^*(s,a) \label{opPol_opQ}&amp;lt;/math&amp;gt; erhalten werden.&lt;br /&gt;
&lt;br /&gt;
Die optimale Policy kann auch aus der optimalen Wertfunktion berechnet werden, indem zunächst die optimale Aktionswertfunktion aus der optimalen Wertfunktion berechnet wird. Dies führt zu &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;Q^*(s,a) = r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V^*(s^{&amp;#039;}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;methodentypen-von-rl&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Methodentypen von RL ==&lt;br /&gt;
&lt;br /&gt;
Es gibt zwei Arten von Methoden zur Lösung eines RL Problems:&lt;br /&gt;
&lt;br /&gt;
* Modellbasierte Methoden (model-based methods)&lt;br /&gt;
* Modellfreie Methoden (model-free methods)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modellbasierte-methoden&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modellbasierte Methoden ===&lt;br /&gt;
&lt;br /&gt;
Wenn das RL Modell die Markov-Eigenschaft erfüllt, d. h. die zukünftige Entwicklung der Zustände und Aktionen nur vom tatsächlichen Zustand abhängt, kann das RL Problem als Markov Entscheidungsprozess (MDP) formuliert werden.&lt;br /&gt;
&lt;br /&gt;
Wenn der Status des Prozesses nach jedem Intervall der Länge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; zurückgesetzt wird, dann ist das MDP episodisch mit einer Episode der Länge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt;. Eine Trajectory (oder Rollout) ist eine Verwirklichung der Abfolge von Zuständen, Aktionen und Belohnungen in einer Episode. In diesem Fall wird die kumulierte ermäßigte Prämie &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R = \sum_{t = 0}^{T-1} \gamma^{t} r_{t}&amp;lt;/math&amp;gt; gegeben. Im nicht-episodischen MDP &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T=\infty&amp;lt;/math&amp;gt;. In diesem Fall stellt die Einstellung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\gamma &amp;lt; 1&amp;lt;/math&amp;gt; die Endlichkeit der diskontierten, akkumulierten Belohnung sicher.&lt;br /&gt;
&lt;br /&gt;
Wenn das Modell gegeben ist, sind die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; und die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; bekannt. Daher kann der rekursive Charakter der Bellman-Gleichungen genutzt werden. Dies ermöglicht die Erstellung von Algorithmen mithilfe dynamischer Programmierung. Die beiden wichtigsten modellbasierten Algorithmen sind&lt;br /&gt;
&lt;br /&gt;
* Value Iteration und&lt;br /&gt;
* Policy Iteration.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Value iteration&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Wertfunktion kann iterativ für alle Zustände aus der Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt;, kombiniert mit der Beziehung zwischen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt;, berechnet werden. Dies ist die Basis für den Value Iteration Algorithmus. Der Pseudocode des Algorithmus wird in Algorithm  dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm  Value iteration&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Eingabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;,&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s, s^{&amp;#039;} \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Ausgabe: die optimale Wertfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisierung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s)&amp;lt;/math&amp;gt; mit einer beliebigen nicht negativen Funktion&amp;lt;br /&amp;gt;&lt;br /&gt;
2 Wenn das Stoppkriterium NICHT erfüllt ist&amp;lt;br /&amp;gt;&lt;br /&gt;
3   for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4     for &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5       &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q(s,a) = r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V(s^{&amp;#039;})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6     end&amp;lt;br /&amp;gt;&lt;br /&gt;
7     &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V(s^{&amp;#039;})= \max_{a^{&amp;#039;}}  Q(s^{&amp;#039;}, a^{&amp;#039;})&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8   end&amp;lt;br /&amp;gt;&lt;br /&gt;
9 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Es kann gezeigt werden, dass der Algorithmus immer gegen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
([Bellman(1957)], [Bertsekas(1987)]) konvergiert. Die optimale Policy kann aus dem berechneten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; bestimmt werden. Dies ist ein Greedy Algorithmus, da &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; in jeder Iteration basierend auf der besten Aktion in jedem Zustand bestimmt wird. Allgemeiner gesagt ist ein Algorithmus Greedy, wenn in jedem Iterationsschritt die Eingabe für die nächste Iteration als die (in gewisser Weise) beste Ausgabe des tatsächlichen Iterationsschritts bestimmt wird. Ein wirksames Stoppkriterium besteht darin, zu iterieren, bis die maximale Differenz zwischen zwei aufeinanderfolgenden Wertfunktionen kleiner als ein vorgeschriebener kleiner &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt;-Wert ist.&lt;br /&gt;
&lt;br /&gt;
Die numerische Komplexität des Algorithmus beträgt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(|\mathcal{S}|^2 |\mathcal{A}| I)&amp;lt;/math&amp;gt;, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;I&amp;lt;/math&amp;gt; die Anzahl der erforderlichen Iterationen ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Policy Iteration&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bei der Value Iteration wird die optimale Policy indirekt aus der optimalen Wertfunktion ermittelt. Im Policy Iteration Algorithmus wird die Policy direkt in jedem Iterationsschritt berechnet. Die iterative Berechnung der Policy kann direkt erfolgen, indem eine Gleichung verwendet wird, die wiederum aus der Kombination der Bellman-Gleichung für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; mit der Beziehung zwischen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V^*(s)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;Q^*(s,a)&amp;lt;/math&amp;gt; erhalten wird. Dies führt zu&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\pi^*(s) = \arg \max_{a} \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V_{\pi^*}^*(s^{&amp;#039;}) \right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die rekursive Berechnung der nächsten Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}&amp;lt;/math&amp;gt; basierend auf der obigen Gleichung erfordert die Berechnung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; für jedes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s^{&amp;#039;} \in \mathcal {S}&amp;lt;/math&amp;gt; aus der tatsächlichen Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi(s)&amp;lt;/math&amp;gt;. Dies kann erreicht werden, indem die Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt; auf die Bellman-Gleichungen der Wertfunktion angewendet und für die Werte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; gelöst wird. Sie bilden ein lineares Gleichungssystem, da sie keine Maximaloperation beinhalten. Das Zusammenfügen all dieser Punkte ergibt den Policy Iteration Algorithmus. Der Pseudocode des Algorithmus wird in Algorithm  angezeigt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm  Policy iteration&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Eingabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Belohnungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;,&amp;lt;br /&amp;gt;&lt;br /&gt;
- die Übergangswahrscheinlichkeiten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(s^{&amp;#039;}|s,a)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s, s^{&amp;#039;} \in \mathcal{S}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a \in \mathcal{A}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Ausgabe: die optimale Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^*(s)&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Auswählen eine beliebige Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}(s)&amp;lt;/math&amp;gt; und Einstellen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi \neq \pi^{&amp;#039;}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;} \neq \pi&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3 &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi = \pi^{&amp;#039;}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4 Berechnen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s^{&amp;#039;})&amp;lt;/math&amp;gt; aus der Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi&amp;lt;/math&amp;gt;, durch Lösung eines linearen Gleichungssystems lösen&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;V_{\pi}(s) = \left(r(s,\pi(s)) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}}  p(s^{&amp;#039;}|s,a)    V_{\pi}(s^{&amp;#039;}) \right)&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5 Aktualisieren die Policy als&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt;  &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi^{&amp;#039;}(s) = \arg \max_{a} \left(r(s,a) + \gamma \sum_{s^{&amp;#039;} \in \mathcal{S}} p(s^{&amp;#039;}|s,a) V_{\pi}(s^{&amp;#039;})\right)&amp;lt;/math&amp;gt; for every &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s \in \mathcal{S}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Das Aktualisieren der Policy bedeutet, die beste erste Aktion anstelle der zuvor von der Policy verwendeten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\pi(s)&amp;lt;/math&amp;gt; zu bestimmen. Wenn sie unterschiedlich sind, verbessert die Änderung der ersten Aktion strikt die Wertfunktion (der Wert mit der besten Aktion ist aufgrund von max besser als mit der vorherigen Aktion) und damit auch die Policy. Wenn in der Policy keine Aktion geändert werden, ist keine Verbesserung möglich und die Policy ist somit optimal. Die Anzahl der Iterationen ist mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{S}|&amp;lt;/math&amp;gt; höchstens exponentiell, da die Anzahl der verschiedenen Policy &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\mathcal{A}|^{|\mathcal{S}|}&amp;lt;/math&amp;gt; beträgt. Die Anzahl der Operationen ist jedoch pseudopolynomiell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;modellfreie-methoden&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Modellfreie Methoden ===&lt;br /&gt;
&lt;br /&gt;
Wenn kein MDP vorhanden ist, da die Zustände nicht vollständig beobachtbar (fully observable) sind, können in einigen Fällen andere Modelle etabliert werden. Bei MDP stellt die Markov-Eigenschaft sicher, dass die Zustände vollständig beobachtbar sind. Dies ist jedoch nicht immer realistisch. Wenn die Zustände nicht vollständig beobachtbar sind, dann können in einigen Fällen die teilweise beobachtbaren MDPs (partially observable MDPs - POMDPs) ermittelt werden, die die Verallgemeinerung der MDPs darstellen.&lt;br /&gt;
&lt;br /&gt;
Wenn kein Modell vorhanden ist oder das Modell nicht bekannt ist, können modellfreie Methoden verwendet werden. Sie funktionieren auch, wenn es ein MDP-Modell oder ein anderes Modell als MDP, die teilweise beobachtbaren MDPs oder das Multiarmed-Bandit-Modell vorhanden ist.&lt;br /&gt;
&lt;br /&gt;
Zu den wichtigsten modellfreien Algorithmen gehören:&lt;br /&gt;
&lt;br /&gt;
* Temporal Difference (TD) Learning + Bootstrapping&lt;br /&gt;
* Q-Learning (einschließlich SARSA)&lt;br /&gt;
* Function approximation (Funktionsnäherung)&lt;br /&gt;
* Policy Based Methoden (Policy-basierte Methoden) oder Policy Optimization&lt;br /&gt;
&lt;br /&gt;
Weitere Einzelheiten zu modellfreien RL-Methoden können in [Li(2018)] gefunden werden.&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Verschiedene_Techniken_f%C3%BCr_maschinelles_Lernen_und_Deep_Learning&amp;diff=6423</id>
		<title>Verschiedene Techniken für maschinelles Lernen und Deep Learning</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.fernfh.ac.at/mediawiki/index.php?title=Verschiedene_Techniken_f%C3%BCr_maschinelles_Lernen_und_Deep_Learning&amp;diff=6423"/>
		<updated>2024-09-14T23:12:00Z</updated>

		<summary type="html">&lt;p&gt;SAFFER Zsolt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span id=&amp;quot;sec:Ver_Tech_ML_DL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
= Verschiedene Techniken für maschinelles Lernen und Deep Learning =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;support-vektor-maschinen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Support-Vektor-Maschinen ==&lt;br /&gt;
&lt;br /&gt;
Support-Vektor-Maschinen (support vector machines - SVMs) sind moderne Klassifikatoren. In ihrer ursprünglichen Form können sie auf die Klassifizierung mit zwei Klassen angewendet werden (binären Klassifikator - binary classifier). Die gute Klassifizierungsfähigkeit von SVMs basiert auf der Idee, dass eine Erhöhung der Dimensionalität der Eingabedaten eine bessere Trennbarkeit der Klassen ermöglicht. Je höher die Dimension der Projektion der Eingabedaten, desto größer ist die Wahrscheinlichkeit einer besseren Trennfähigkeit der entsprechenden Hyperebenen. Der Name SVM kommt von den Support-Vektoren, den Feature Vektoren des Trainingssatzes, die am Rand der Klassen im hochdimensionalen Raum liegen. Es stellt sich heraus, dass sie die optimale Entscheidungsfläche vollständig bestimmen.&lt;br /&gt;
&lt;br /&gt;
SVMs werden für verschiedene reale Probleme eingesetzt, darunter unter anderem die Erkennung handschriftlicher Zeichen (hand-written character recognition), die Bildklassifizierung, die Klassifizierung von Satellitendaten (satellite data classification) und Klassifizierungsaufgaben in den Biowissenschaften (classification tasks in biological sciences).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;lineare-svm-mit-linear-trennbaren-klassen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Lineare SVM mit linear trennbaren Klassen ===&lt;br /&gt;
&lt;br /&gt;
Eine SVM ist linear, wenn ihre Entscheidungsfläche im Raum der Eingabevektoren linear ist, also eine Hyperebene ist. Angenommen, der Eingabedaten ist durch die &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;-dimensionalen Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_1, \ldots, {\bf x}_N&amp;lt;/math&amp;gt; und ihre entsprechenden Klassenbezeichnungen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_1,\ldots, y_N&amp;lt;/math&amp;gt; gegeben. Die beste Trennfähigkeit kann durch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L-1&amp;lt;/math&amp;gt;-dimensionale Hyperebenen erreicht werden. Die Klassen sind linear trennbar, wenn zwischen den Klassen Hyperebenen liegen. In diesem Unterabschnitt diskutieren wir lineare SVM mit linear trennbaren Klassen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimale Hyperebene als Entscheidungsflächen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Im Allgemeinen gibt es bei linear trennbaren Klassen viele Hyperebenen, die die Klassen trennen können. Ihre Trennfähigkeit hängt jedoch von ihrer Positionierung zu den Klassen der Eingabedaten ab, siehe Abbildung [[#fig:SVM_2|26]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:SVM_2&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:SVM_WIPE_1.jpg|460px|thumb|center|Abbildung 26: Abhängigkeit der Trennfähigkeit von Hyperebenen von ihrer Position zu den Klassen der Eingabedaten (Quelle: [https://en.wikipedia.org/wiki/Support_vector_machine Wikipedia_SVM]).]] &amp;lt;span id=&amp;quot;fig:SVM_2&amp;quot; label=&amp;quot;fig:SVM_2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Intuitiv ergibt die Hyperebene mit dem größten Abstand zu den Klassen die größte Trennungsfähigkeit. Der Abstand einer Hyperebene zu den Klassen entspricht dem Abstand zu ihren nächstgelegenen Punkten. Die Summe der Abstände von einer Hyperebene zu den Klassen wird als Margin bezeichnet. Z. B. in Abbildung [[#fig:SVM_2|26]] H1 trennt die Klassen gar nicht. H2 und H3 schon, aber H2 nur mit einer kleinen Margin. H3 ist die Hyperebene, die die Klassen mit der maximalen Margin trennt.&lt;br /&gt;
&lt;br /&gt;
Tatsächlich kann gezeigt werden, dass die Hyperebene mit dem größten Margin als Entscheidungsfläche die optimale ist, in dem Sinne, dass sie bei der Klassifizierung den geringeren Generalisierungsfehler verursacht. Die optimale Hyperebene wird als Hyperebene mit maximalem Margin bezeichnet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimierungsaufgabe zum Finden der Maximum-Margin Hyperebene&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Jede Hyperebene kann durch eine lineare Gleichung in Normalform beschrieben werden als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w}^T {\bf x} + c = 0.&amp;lt;/math&amp;gt; Hier ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; ein &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;-dimensionaler Normalenvektor, d. h. er ist rechtwinklig zur Hyperebene und die Konstante &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; hängt von der Größe von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; ab (Multiplikation der obigen Gleichung mit einer beliebigen Konstante &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; bleibt die Richtung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; gleich, aber sowohl seine Größe als auch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; ändern sich). Die Projektion eines beliebigen Punktes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt; als Vektor auf die Richtung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\frac{{\bf w}^T {\bf x}}{\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt;. Andererseits impliziert die Gleichung der Hyperebene, dass für jeden auf der Hyperebene liegenden Punkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^T {\bf x} = -c&amp;lt;/math&amp;gt; gilt. Somit ist die Projektion eines beliebigen Punktes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt;, der auf der Hyperebene liegt, als Vektor auf die Richtung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; kann durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\frac{-c}{\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt; gegeben werden. Wählen wir die Konstante &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; in den Gleichungen der an den Klassengrenzen liegenden Hyperebenen als &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b-1&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b+1&amp;lt;/math&amp;gt;, was für diese Hyperebenen zu den Gleichungen als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;{\bf w}^T {\bf x} + b = 1,  \\&lt;br /&gt;
&amp;amp;{\bf w}^T {\bf x} + b = -1 &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; führt. Dann entspricht der Margin für eine Hyperebene, die auf halber Strecke zwischen den oben genannten Hyperebenen liegt, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\rho({\bf w},b)&amp;lt;/math&amp;gt; dem Abstand zwischen diesen Hyperebenen. Der kann als Differenz der Projektionen jedes auf diesen Hyperebenen liegenden Punktes auf ihren Normalenvektor berechnet werden, der durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\rho({\bf w},b) = \frac{(1-b)}{\lVert {\bf w} \rVert} - \frac{(-b-1)}{\lVert {\bf w} \rVert}= \frac{2}{\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt; gegeben ist.&lt;br /&gt;
&lt;br /&gt;
Daraus folgt, dass die Maximierung der Margin gleichwertig mit der Minimierung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lVert {\bf w} \rVert^2&amp;lt;/math&amp;gt; ist.&lt;br /&gt;
&lt;br /&gt;
Somit beträgt der Abstand zwischen der Hyperebene, die auf halbem Weg zwischen den obigen Hyperebenen liegt, und einer von ihnen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\frac{1}{\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt;, was impliziert, dass für die Gleichung der Hyperebene, die auf halbem Weg zwischen die obigen Hyperebenen liegt, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\frac{(1-b)}{\lVert {\bf w} \rVert} - \frac{(-c)}{\lVert {\bf w} \rVert}= \frac{1} {\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt; gilt, woraus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c=b&amp;lt;/math&amp;gt; und somit ist diese Gleichung durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w}^T {\bf x} + b = 0&amp;lt;/math&amp;gt; gegeben. Diese Hyperebenen und die oben genannten Abstände sind in Abbildung [[#fig:SVM_3|27]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:SVM_3&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:SVM_WIPE_3.jpg|460px|thumb|center|Abbildung 27: Hyperebene, die auf halber Strecke zwischen den Klassen liegt, deren Abstände und Margin (Quelle: [https://en.wikipedia.org/wiki/Support_vector_machine Wikipedia_SVM]).]] &amp;lt;span id=&amp;quot;fig:SVM_3&amp;quot; label=&amp;quot;fig:SVM_3&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wählen wir die Bezeichnungen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i=1&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i=-1&amp;lt;/math&amp;gt; für die erste bzw. zweite Klasse. Dann erfüllen alle Vektoren der Eingabedaten, die zur ersten und zweiten Klasse gehören, jeweils die Ungleichungen &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;{\bf w}^T {\bf x}_i + b \geq 1,   \mathrm{~wenn~} y_i = 1  \mathrm{~and~}  \\&lt;br /&gt;
&amp;amp;{\bf w}^T {\bf x}_i + b \leq -1.   \mathrm{~wenn~} y_i = -1.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Diese beiden Ungleichungen können in einer äquivalenten kompakten Form als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;y_i({\bf w}^T {\bf x}_i + b) \geq 1&amp;lt;/math&amp;gt; geschrieben werden. Wenn man all dies zusammenfügt, ergibt sich die Optimierungsaufgabe mit Nebenbedingungen (constrained optimization task) zum Finden der Maximum-Margin Hyperebene als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;({\bf w}, b) = \arg \min_{{\bf w}, b} \lVert {\bf w} \rVert^2, ~ \mathrm{~unter~den~Bedingungen~}~ \\&lt;br /&gt;
  &amp;amp;  y_i({\bf w}^T {\bf x}_i + b) \geq 1, ~~i=1,\ldots,N.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Quadratisches Programm (quadratic programming problem) für die Lagrange-Multiplikatoren&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Um das Optimierungsproblem mit Nebenbedingungen zu lösen, die Lagrange-Funktion wird konstruiert als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;L({\bf w}, b, {\boldsymbol{\Lambda}}) = \frac{1}{2} {\bf w}^T{\bf w} - \sum_{i=1}^N \lambda_i \left( y_i ({\bf w}^T {\bf x}_i + b) -1\right),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
wobei die Elemente von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\Lambda}}^T =(\lambda_1,\ldots,\lambda_N)&amp;lt;/math&amp;gt; aufgrund der Nebenbedingungen die nicht negativen Lagrange-Multiplikatoren sind. Berechnen die ersten Ableitungen nach &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; bei Minimum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b^{*}&amp;lt;/math&amp;gt; ergibt &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left.{\frac{ \partial L({\bf w}, b, {\boldsymbol{\Lambda}})}{\partial {\bf w}}}\right|_{{\bf w}={\bf w}^{*}} = \left({\bf w}^{*} - \sum_{i=1}^N \lambda_i y_i {\bf x}_i \right) =0,&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\left.{\frac{ \partial L({\bf w}, b, {\boldsymbol{\Lambda}})}{\partial b}}\right|_{b=b^{*}} = \sum_{i=1}^N \lambda_i y_i =0.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wenn man sie in die Lagrange-Funktion bei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w} = {\bf w}^{*}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b=b^{*}&amp;lt;/math&amp;gt; einsetzt, erhält man &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
L({\bf w}^{*}, b^{*}, {\boldsymbol{\Lambda}}) &amp;amp;= \frac{1}{2} {{\bf w}^{*}}^T{\bf w}^{*} -  \sum_{i=1}^N \lambda_i y_i {{\bf w}^{*}}^T {\bf x}_i - \sum_{i=1}^N \lambda_i y_i b^{*} +  \sum_{i=1}^N \lambda_i\\&lt;br /&gt;
&amp;amp;= \frac{1}{2} {{\bf w}^{*}}^T{\bf w}^{*} - {{\bf w}^{*}}^T{\bf w}^{*} + \sum_{i=1}^N \lambda_i \\&lt;br /&gt;
&amp;amp;= \sum_{i=1}^N \lambda_i - \frac{1}{2} {{\bf w}^{*}}^T{\bf w}^{*}\\&lt;br /&gt;
&amp;amp;= \sum_{i=1}^N \lambda_i - \frac{1}{2} \sum_{i=1}^N \sum_{j=1}^N \lambda_i \lambda_j y_i y_j {\bf x}_i {\bf x}_j.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Einführung des Label Vektors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}&amp;lt;/math&amp;gt; und der symmetrischen Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N \times N&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp; {\bf y}^T = (y_1,\ldots, y_N), \\   &lt;br /&gt;
  &amp;amp;{\bf D} = [{\bf D}_{ij}]=[y_i y_j {\bf x}_i {\bf x}_j]&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ermöglicht die Erstellung eines quadratischen Programms in Vektor-Matrix-Notation für die Lagrange-Multiplikatoren as &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\arg \max_{{\boldsymbol{\Lambda}}} L({\boldsymbol{\Lambda}}) = \arg \max_{{\boldsymbol{\Lambda}}} {\boldsymbol{\Lambda}}^T {\bf e} - \frac{1}{2}{\boldsymbol{\Lambda}}^T {\bf D}{\boldsymbol{\Lambda}}, ~ \mathrm{~unter~den~Bedingungen~}~ \\&lt;br /&gt;
    &amp;amp; {\boldsymbol{\Lambda}}^T {\bf y} = 0, ~ \mathrm{~fuer~}~{\boldsymbol{\Lambda}} \geq {\bf 0},&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf e}&amp;lt;/math&amp;gt; für den &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt;-dimensionalen Einheitsvektor steht.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;remark&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Bemerkung 1&amp;#039;&amp;#039;&amp;#039;.  &amp;#039;&amp;#039;Die Nebenbedingung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\Lambda}}^T {\bf y} = 0&amp;lt;/math&amp;gt; ist dieselbe wie die partielle Ableitung der Lagrange-Funktion nach &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; in Vektorform. Die andere partielle Ableitung und die ursprünglichen Nebenbedingungen sind hier nicht notwendig, da die Zielfunktion im obigen quadratischen Programmierproblem nicht von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; abhängt.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Die Eigenschaften der optimalen Hyperebene&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nach dem Kuhn-Tucker-Theorem &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    \lambda_{i}^{*} \left(y_i({{\bf w}^{*}}^T{\bf x}_i + b^{*}) \right) = 0, ~~ i= 1, \ldots, N&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gilt für die optimalen Parameter der Lagrange-Funktion. Daraus folgt, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_{i}^{*} \neq 0&amp;lt;/math&amp;gt; nur für die Fälle gilt, in denen die Ungleichung-Constraint zu einer Gleichheit wird, d. h. wenn &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
     y_i({{\bf w}^{*}}^T{\bf x}_i + b^{*}) - 1 = 0  ~\Leftrightarrow~ y_i({{\bf w}^{*}}^T{\bf x}_i + b^{*}) =1&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gilt. Die Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_i&amp;lt;/math&amp;gt; der Eingabedaten, die die obige Gleichheit erfüllen, werden Support-Vektoren genannt. Dies sind die Vektoren, die zu den an den Klassengrenzen liegenden Hyperebenen passen.&lt;br /&gt;
&lt;br /&gt;
Für die optimale Hyperebene gelten folgende Eigenschaften:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; Der Parametervektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; der optimalen Hyperebene kann als lineare Kombination der Support-Vektoren als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w}^{*} = \sum_{i=1}^N \lambda_{i}^{*} y_i {\bf x}_i.&amp;lt;/math&amp;gt; ausgedrückt werden.&lt;br /&gt;
* &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.2&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; Die Support-Vektoren bestimmen vollständig die optimale Hyperebene, also sowohl &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; als auch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b^{*}&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.3&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; Zwischen dem Wert der Lagrange-Funktion im Optimum und dem Margin für die optimale Hyperebene, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\rho^{*}&amp;lt;/math&amp;gt; gilt die Relation, &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;L({\bf w}^{*}, b^{*}, {\boldsymbol{\Lambda}}^{*}) = \frac{2}{{\rho^{*}}^2}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Gleichung von &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; kann durch Umstellen der Gleichung erhalten werden, die als erste Ableitung der Lagrange-Funktion nach &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; erhalten wurde. Die &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_i&amp;lt;/math&amp;gt;-s für jedes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_{i}^{*} \neq 0&amp;lt;/math&amp;gt; erfüllen die Gleichheit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i({{\bf w}^{*}}^T{\bf x  }_i + b^{*}) =1&amp;lt;/math&amp;gt; und somit sind sie Support-Vektoren. Daher wird &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; in der Expression in &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; als Linearkombination der Support-Vektoren angegeben. Dies legt nahe, dass nur diese Vektoren des Eingabedaten einen effektiven Beitrag zum Parametervektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; leisten, was den Namen „Support-Vektor“ erklärt.&lt;br /&gt;
&lt;br /&gt;
Nachdem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; bestimmt wurde, kann &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b^{*}&amp;lt;/math&amp;gt; durch Einsetzen eines beliebigen Support-Vektoren in die Gleichung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i({{\bf w}^{*}}^T {\bf x}_i + b^{*}) =1&amp;lt;/math&amp;gt; berechnet werden. Damit ist &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.2&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; gezeigt.&lt;br /&gt;
&lt;br /&gt;
Um &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.3&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; zu zeigen, stellen wir eine Beziehung zwischen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{{\bf w}^{*}}^T {\bf w}^{*}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{i=1}^N \lambda_{i}^{*}&amp;lt;/math&amp;gt; her als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{{\bf w}^{*}}^T {\bf w}^{*}= \sum_{i=1}^N \lambda_{i}^{*} y_i  {{\bf w}^{*}}^T {\bf x}_i = \sum_{i=1}^N \lambda_{i}^{*} (1-y_i b^{*}) = \sum_{i=1}^N \lambda_{i}^{*},&amp;lt;/math&amp;gt; wobei &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;, die Gleichheit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i({{\bf w}^{*}}^T{\bf x}_i + b^{*}) =1&amp;lt;/math&amp;gt; für die Support-Vektoren und die Beziehung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{i=1}^N \lambda_i y_i =0&amp;lt;/math&amp;gt; bei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_i =\lambda_{i}^{*}&amp;lt;/math&amp;gt; verwendet wurden. Die Anwendung dieser Beziehung auf die Lagrange-Funktion im Optimum führt zu &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;L({\bf w}^{*}, b^{*}, {\boldsymbol{\Lambda}}^{*}) = \sum_{i=1}^N \lambda_{i}^{*} - \frac{1}{2} {{\bf w}^{*}}^T{\bf w}^{*} = \frac{1}{2} {{\bf w}^{*}}^T{\bf w}^{*}&amp;lt;/math&amp;gt; Kombiniert man es mit dem Ausdruck der Margin &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\rho({\bf w}, b)=\frac{2}{\lVert {\bf w} \rVert}&amp;lt;/math&amp;gt; bei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w} = {\bf w }^{*}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b=b^{*}&amp;lt;/math&amp;gt; ergibt &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\rho^{*}}^2 = \frac{4}{2 L({\bf w}^{*}, b^{*}, {\boldsymbol{\Lambda}}^{*})} = \frac{2}{L({\bf w}^{*}, b^{*}, {\boldsymbol{\Lambda}}^{*})},&amp;lt;/math&amp;gt; woraus &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.3&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; direkt folgt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimaler Hyperebenen-Algorithmus&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basierend auf den obigen Unterkapiteln kann ein Algorithmus zur Bestimmung des linearen SVM-Klassifikators mit linear trennbaren Klassen erstellt werden, d. h. um die Parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; zu berechnen. Dieser optimale Hyperebenen-Algorithmus besteht aus den folgenden Schritten:&lt;br /&gt;
&lt;br /&gt;
# Berechnen das optimale &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{{\boldsymbol{\Lambda}}^{*}}^T =(\lambda_1^{*},\ldots,\lambda_N^{*})&amp;lt;/math&amp;gt;, durch Löung des quadratischen Programms &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp;\arg \max_{{\boldsymbol{\Lambda}}} L({\boldsymbol{\Lambda}}) = \arg \max_{{\boldsymbol{\Lambda}}} {\boldsymbol{\Lambda}}^T {\bf e} - \frac{1}{2}{\boldsymbol{\Lambda}}^T {\bf D}{\boldsymbol{\Lambda}}, ~ \mathrm{~unter~den~Bedingungen~}~ \\&lt;br /&gt;
    &amp;amp; {\boldsymbol{\Lambda}}^T {\bf y} = 0, ~ \mathrm{~fuer~}~{\boldsymbol{\Lambda}} \geq {\bf 0},&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Berechnen die optimalen Parametergewichte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; basierend auf der Eigenschaft &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;, d. h. aus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda_{i}&amp;lt;/math&amp;gt;-s und aus den Support-Vektoren unter Verwendung der Gleichung &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w}^{*} = \sum_{i=1}^N \lambda_{i}^{*} y_i {\bf x}_i.&amp;lt;/math&amp;gt;&lt;br /&gt;
# Berechnen den Parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b^{*}&amp;lt;/math&amp;gt;, indem einen Support-Vektor in die Gleichung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i({{\bf w}^{*}}^T{\bf x}_i + b^{*}) =1&amp;lt;/math&amp;gt; eingesetzt wird.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;lineare-svm-mit-linear-nicht-trennbaren-klassen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Lineare SVM mit linear nicht trennbaren Klassen ===&lt;br /&gt;
&lt;br /&gt;
Wenn die Klassen linear nicht trennbar sind, gibt es keine Hyperebene, die alle Trainingsbeispiele korrekt trennen kann. In diesem Fall kann man nach der Hyperebene suchen, die die meisten Trainingsbeispiele trennen kann, d. h. was den geringsten Fehler bei der Trennung macht. Daher muss der Fehler bei der Trennung in die Formulierung der Optimierungsaufgabe zum Finden der optimalen Hyperebene einbezogen werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:SVM_4&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:SVM_cmu_edu_1.jpg|460px|thumb|center|Abbildung 28: Hyperebene für linear nicht trennbare Klassen mit fehlerhaft getrennten Trainingsbeispielen (Quelle: [https://www.cs.cmu.edu/~aarti/Class/10701_Spring21/Lecs/svm_dual_kernel_inked.pdf cmu_edu]).]] &amp;lt;span id=&amp;quot;fig:SVM_4&amp;quot; label=&amp;quot;fig:SVM_4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Optimierungsaufgabe zum Finden der optimalen Hyperebene&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi_i&amp;lt;/math&amp;gt; der Fehler des fälschlicherweise getrennten Trainingsbeispiels &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_i&amp;lt;/math&amp;gt;, der im der ausgewählten Hyperebene zugeordneten Margin liegt, siehe Abbildung [[#fig:SVM_4|28]]. Die Trainingsbeispiele mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\xi_i=0&amp;lt;/math&amp;gt; (grüne Kreise) sind Support-Vektoren. Die Trainingsbeispiele mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0 &amp;lt; \xi_i &amp;lt; 1&amp;lt;/math&amp;gt; (lila Kreise) sind richtig klassifiziert, liegen aber innerhalb des Margins. Die Trainingsbeispiele mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1 &amp;lt; \xi_i&amp;lt;/math&amp;gt; (lila Kreise) sind falsch klassifiziert. Die zuvor für die linear separierbaren Klassen festgelegte Nebenbedingungen müssen geändert werden, da die fehlerhaft separierten Trainingsbeispiele innerhalb des Margins liegen. Die richtige Nebenbedingung, die den Fehler des fälschlicherweise getrennten Trainingsbeispiele berücksichtigt, kann wie folgt formuliert werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;y_i({\bf w}^T {\bf x}_i + b) \geq 1 - \xi_i, ~~ \mathrm{~wobeie~}~~\xi_i \geq 0, ~~i=1,\ldots,N.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Jetzt wollen wir nicht nur &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lVert {\bf w} \rVert^2&amp;lt;/math&amp;gt; sondern auch den Gesamtfehler bei der Trennung minimieren, um einen großen Margin zu haben. Hier den Gesamtfehler kann als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\sum_{i=1}^{N} \xi_i&amp;lt;/math&amp;gt; ausgedrückt werden.&lt;br /&gt;
&lt;br /&gt;
Je kleiner der Wert &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lVert {\bf w} \rVert^2&amp;lt;/math&amp;gt;, desto größer der Margin, was zu einem größeren Gesamtfehler bei der Trennung führt. Somit stehen der Wert &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lVert {\bf w} \rVert^2&amp;lt;/math&amp;gt; und der Gesamtfehler bei der Trennung im Kompromiss zueinander. Daher ist die Optimierungsaufgabe mit Nebenbedingungen zum Finden der optimalen Hyperebene für linear nicht trennbare Klassen wird durch &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
  &amp;amp;({\bf w}, b) = \arg \min_{{\bf w}, b} \frac{1}{2}\lVert {\bf w} \rVert^2 + G \sum_{i=1}^{N} \xi_i, ~ \mathrm{~unter~den~Bedingungen~}~ \\&lt;br /&gt;
  &amp;amp;  y_i({\bf w}^T {\bf x}_i + b) \geq 1- \xi_i, ~~ \mathrm{~und~}~~\xi_i \geq 0, ~~i=1,\ldots,N&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gegeben, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G&amp;lt;/math&amp;gt; eine Konstante ist, die die Gewichtung der beiden zu minimierenden Ziele festlegt. Die optimale Hyperebene wird Soft-Margin-Hyperebene genannt. Der Name kommt von der Art dieses Margin, der das Überhängen mehrerer Trainingsbeispiele ermöglicht. Es kann gezeigt werden, dass alle Eigenschaften &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; - &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.3&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; auch für diesen nicht trennbaren Fall gelten.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;remark&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Bemerkung 2&amp;#039;&amp;#039;&amp;#039;.  &amp;#039;&amp;#039;Wenn diese Optimierung mit einem hohen Wert von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G&amp;lt;/math&amp;gt; angewendet wird, dann verhält sie sich ähnlich wie die Optimierung für trennbare Klassen.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;svm-mit-nichtlinearem-kernel&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== SVM mit nichtlinearem Kernel ===&lt;br /&gt;
&lt;br /&gt;
Im Fall linear nicht trennbarer Klassen kann eine bessere Trennbarkeit durch die Verwendung einer nichtlinearen Entscheidungsfläche anstelle einer Hyperebene erreicht werden. Dies wird in Abbildung [[#fig:SVM_5|29]] veranschaulicht.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:SVM_5&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:SVM_WIPE_2a.jpg|460px|thumb|center|Abbildung 29: Nichtlineare Entscheidungsfläche für nicht trennbare Klassen (Quelle: [https://en.wikipedia.org/wiki/Support_vector_machine Wikipedia_SVM]).]] &amp;lt;span id=&amp;quot;fig:SVM_5&amp;quot; label=&amp;quot;fig:SVM_5&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Die Idee der nichtlinearen SVM&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aus diesem Grund wird die Theorie der Support Vector Machine auf nichtlineare Entscheidungsflächen erweitert. Die Idee dieser Erweiterung besteht darin, die Eingabevektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_i&amp;lt;/math&amp;gt; in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionale Vektoren umzuwandeln, indem eine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionale Vektorfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; auf sie angewendet und dann eine optimale Hyperebene im &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionalen Raum der transformierten Vektoren konstruiert wird. Durch richtig ausgewählte Vektorfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; werden die transformierten Klassen im &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionalen Raum wieder durch eine optimale Hyperebene linear trennbar ! Dies ist in Abbildung [[#fig:SVM_6|30]] illustriert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:SVM_6&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:SVM_WIPE_2.jpg|460px|thumb|center|Abbildung 30: Nichtlineare Entscheidungsfläche für nicht trennbare Klassen (Quelle: [https://en.wikipedia.org/wiki/Support_vector_machine Wikipedia_SVM]).]] &amp;lt;span id=&amp;quot;fig:SVM_6&amp;quot; label=&amp;quot;fig:SVM_6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Dann ist die potentielle Entscheidungsgrenze eine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionale Hyperebene für die transformierten Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}({\bf x}_i) = (\phi_1({\bf x}_i), \ldots, \phi_M( {\bf x}_i)&amp;lt;/math&amp;gt;, für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1,\ldots,N&amp;lt;/math&amp;gt; mit den Parametern &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt;, welche die Form &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f({\bf x}) = {\bf w}^T {\boldsymbol{\phi}}({\bf x}) + b&amp;lt;/math&amp;gt; hat.&lt;br /&gt;
&lt;br /&gt;
Unter Anwendung der Eigenschaft &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;P.1&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; der Soft-Margin-Hyperebene im &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt;-dimensionalen Raum der transformierten Vektoren kann der optimale Parametervektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^{*}&amp;lt;/math&amp;gt; als Linearkombination von der Support-Vektoren im transformierten Raum als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf w}^{*} = \sum_{i=1}^{N} \lambda_i^{*} y_i  {\boldsymbol{\phi}}({\bf x}_i)&amp;lt;/math&amp;gt; bestimmt werden. Wenn man es in die Expression der Entscheidungsgrenze einsetzt, kann man die Entscheidungsfläche &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^{*}({\bf x})&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f^{*}({\bf x}) = \sum_{i=1}^{N} \lambda_i^{*} y_i {\boldsymbol{\phi}}({\bf x})^T {\boldsymbol{\phi}}({\bf x}_i) + b^{*}.&amp;lt;/math&amp;gt; ausdrücken.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Der Kernel-Trick&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das einzige Rechenproblem besteht darin, potenzielle hochdimensionale Räume zu behandeln, die in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}({\bf x})&amp;lt;/math&amp;gt; für große Werte von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M&amp;lt;/math&amp;gt; entstehen. Tatsächlich ist es jedoch nicht erforderlich. Die Entscheidungsfunktion (decision function) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^{*}({\bf x})&amp;lt;/math&amp;gt; hängt nur vom Skalarprodukt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}({\bf x})^T {\boldsymbol{\phi}}({\bf x}_i)&amp;lt;/math&amp;gt; und nicht von den einzelnen Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}({\bf x})&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}({\bf x}_i)&amp;lt;/math&amp;gt; ab. Unter bestimmten Bedingungen gibt es Funktionen K(&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;u&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;, &amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;v&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;), die wie folgt faktorisiert werden können. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;K({\bf u}, {\bf v}) = {\boldsymbol{\phi}}({\bf u}) {\boldsymbol{\phi}}({\bf v}).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mit einer solchen Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K({\bf u}, {\bf v})&amp;lt;/math&amp;gt; kann die Entscheidungsgrenze &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^{*}({\bf x})&amp;lt;/math&amp;gt; in der Form &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;f^{*}({\bf x}) = \sum_{i=1}^{N} \lambda_i^{*} y_i  K({\bf x}, {\bf x}_i) + b^{*}&amp;lt;/math&amp;gt; geschrieben werden. Die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K({\bf u}, {\bf v})&amp;lt;/math&amp;gt; eine Skalarfunktion ist. Dies bedeutet, dass es ausreicht, statt potenziell hochdimensionalen Vektorfunktionen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}&amp;lt;/math&amp;gt; zunächst einen von interner Form von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K(,)&amp;lt;/math&amp;gt; abhängigen Operator, wie z.B. Skalarprodukt oder eine beliebige Distanz, auf die Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_i&amp;lt;/math&amp;gt; anzuwenden, und das Ergebnis dann in die Skalarfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K()&amp;lt;/math&amp;gt; einzusetzen, die dann rechnerisch leicht berechenbar ist.&lt;br /&gt;
&lt;br /&gt;
Die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K({\bf u}, {\bf v})&amp;lt;/math&amp;gt; wird Kernel genannt und die Idee, sie zu verwenden, anstatt die Vektorenfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\boldsymbol{\phi}}()&amp;lt;/math&amp;gt; zu behandeln, was die Berechnung leicht berechenbar macht, nennt man Kernel-Trick. Maschinen, die den Kernel-Trick anwenden, werden Kernel-Maschinen benannt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eigenschaften von SVM mit nichtlinearem Kernel&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Hauptmerkmale von SVM mit nichtlinearem Kernel kann wie folgt zusammengefasst werden.&lt;br /&gt;
&lt;br /&gt;
# Seine Entscheidungsfunktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f^{*}({\bf x})&amp;lt;/math&amp;gt; kann mit der Hilfe Kernel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K({\bf x}, {\bf x}_i)&amp;lt;/math&amp;gt; ausgedrückt werden.&lt;br /&gt;
# Seine Entscheidungsfunktion ist nichtlinear im Raum des Eingabevektors.&lt;br /&gt;
# Der nichtlinear transformierte Vektorraum kann hochdimensional sein.&lt;br /&gt;
# Die nichtlineare Entscheidungsfläche ist eine Soft-Margin-Hyperebene im transformierten Vektorraum.&lt;br /&gt;
# Die Entscheidungsfläche wird mit dem Soft-Margin-Hyperplane-Algorithmus berechnet, mit der einzigen Unterschied zur Einstellung der Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf D}&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf D} = [{\bf D}_{ij}]=[y_i y_j K({\bf x}_i, {\bf x}_j)].&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Ausgewählte nichtlineare Kernel&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nachfolgend sind einige häufig verwendete nichtlineare Kernel aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* Polynomkernel – für Klassifikator vom Grad &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;K({\bf u}, {\bf v}) = ({\bf u} {\bf v} + a)^d&amp;lt;/math&amp;gt; Für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a=0&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d=1&amp;lt;/math&amp;gt; wird es zum linearen Kernel.&lt;br /&gt;
* Potentialfunktion &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;K({\bf u}, {\bf v}) = exp\left(- \frac{\lVert {\bf u} - {\bf v} \rVert)}{\sigma}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Gaußsche Radialfunktion als Kernel (Gaussian radial function) &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;K({\bf u}, {\bf v}) = exp\left(- \frac{\lVert {\bf u} - {\bf v} \rVert^2)}{2 \sigma^2}\right)&amp;lt;/math&amp;gt;&lt;br /&gt;
* Sigmoid- oder hyperbolische Tangensfunktion &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;K({\bf u}, {\bf v}) = \tanh \left(\alpha {\bf u} {\bf v} + \beta \right),  \mathrm{~fuer~einige~} \alpha &amp;gt; 0  \mathrm{~und~} \beta &amp;lt; 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;erweiterungen&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Erweiterungen ===&lt;br /&gt;
&lt;br /&gt;
SVM verfügt über mehrere Erweiterungen. Nachfolgend befindet sich eine kurze Zusammenfassung der wichtigsten von denen.&lt;br /&gt;
&lt;br /&gt;
* Multiklassen-SVM. Multiclass SVM ist ein Klassifikator, der für mehr als zwei Klassen entwickelt wurde. Der vorherrschende Realisierungsansatz führt auf Klassifikatoren mit zwei Klassen zurück. Eine dieser Methoden ist die Eins-gegen-Alle-Methode (one-versus-all), bei der für jede Klasse ein Klassifikator angewendet wird, um sie vom Rest zu trennen, und der Klassifikator mit der höchsten Ausgabe gewinnt.&lt;br /&gt;
* Transduktive SVM. Transduktive SVM realisiert halbüberwachtes Lernen. Neben dem beschrifteten Trainingdaten wird ein unbeschriftet Daten von Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}^{&amp;#039;}_j&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j=1,\ldots, U&amp;lt;/math&amp;gt; bereitgestellt. Die Optimierungsaufgabe wird modifiziert, indem neben den Parametern &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b&amp;lt;/math&amp;gt; auch nach den vorherzusagenden Labels &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y^{&amp;#039;}_j&amp;lt;/math&amp;gt; gesucht wird und die Nebenbedingungen durch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y^{&amp;#039;}_i ( {\bf w}^T {\bf x}_i + b) \geq 1&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y^{&amp;#039;}_i \in {-1,1}&amp;lt;/math&amp;gt; ergänzt werden.&lt;br /&gt;
* Support-Vektor-Clustering (SVC). SVC ist eine Maschine, die unüberwachtes Lernen realisiert.&lt;br /&gt;
* Strukturierte SVM (structured SVM). Strukturierte SVM ist eine Verallgemeinerung von SVM, die strukturierte und unendlich viele Labels ermöglicht.&lt;br /&gt;
* Support-Vector-Regression (SVR). SVR basiert auf der an die Regression angepassten SVM-Theorie. Jetzt ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf w}^T {\bf x}_i + b&amp;lt;/math&amp;gt; der vorhergesagte Wert und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;y_i&amp;lt;/math&amp;gt; die richtige Ausgabe, wobei beide stetige Werte annehmen. Dann wird die Regression durch die Optimierungsaufgabe mit der Nebenbedingung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|y_i - ({\bf w}^T {\bf x}_i + b)|\leq \epsilon&amp;lt;/math&amp;gt; bestimmt, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\epsilon&amp;lt;/math&amp;gt; ein freier Schwellenwert für Fehler (error threshold) ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Implementierung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Normalerweise ist vor der Berechnung von SVM eine Vorverarbeitung der Trainingsdaten erforderlich. Zu den notwendigen Vorverarbeitungsschritten gehören:&lt;br /&gt;
&lt;br /&gt;
* Skalierung mit Methoden wie Min-Max, Dezimalskalierung (decimal scaling) oder Z-Score.&lt;br /&gt;
* Mittelwertnormalisierung (mean normalization), d. h. Subtrahieren des Mittelwerts von den Vektoren.&lt;br /&gt;
* Varianznormalisierung (variance normalization), d. h. Division jeder Vektorkomponente durch ihre Varianz.&lt;br /&gt;
&lt;br /&gt;
Kernel SVM ist in vielen ML Softwarepaketen implementiert, darunter unter anderem&lt;br /&gt;
&lt;br /&gt;
* P-Pack SVM mit Subgradienten-Verfahren,&lt;br /&gt;
* MATLAB, SAS,&lt;br /&gt;
* LIBSVM, SVMlight,kernlab, JKernelMachines und&lt;br /&gt;
* scikit-learn Python-Bibliothek.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;entscheidungsbäume-und-random-forests&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Entscheidungsbäume und Random Forests ==&lt;br /&gt;
&lt;br /&gt;
Klassifikations- und Regressionsbäume (Classification and Regression Trees - CART) sind Entscheidungsbäume, die für Klassifikations- und Regressionsaufgaben verwendet werden können. In diesem Unterabschnitt diskutieren wir den Ansatz von Entscheidungsbäume für Klassifikationsaufgaben.&lt;br /&gt;
&lt;br /&gt;
Klassifikationsbäume realisieren eine hierarchische Partitionierung des Raumes der Eingabevektoren. Die Eingabevektoren werden auch als Featurevektoren genannt, da jede einzelne Komponente der Eingabevektoren ein Merkmal (also Feature) darstellt. Die Partitionierung führt zu einzelnen disjunkten Bereichen des Raumes der Eingabevektoren, von denen jeder einer Klasse zugeordnet ist. Die Grundidee des Klassifikationsbaums ist also die Zuordnung disjunkter Bereiche des Raumes der Eingabevektoren zu Klassen, was sich wesentlich von den Ideen anderer Klassifikationsmethoden unterscheidet, wie z. B. neuronalen Netzen, die Diskriminanzfunktionen realisieren, oder Support Vector Machines, die Entscheidungsgrenzen als Hyperebene realisieren.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ein-medizinisches-beispiel&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ein medizinisches Beispiel ===&lt;br /&gt;
&lt;br /&gt;
In einem medizinischen Beispiel werden die Patienten in Hochrisiko- und Niedrigrisiko-Patienten eingeteilt. Die Einteilung erfolgt durch Fragen an die Patienten. Die Fragen können in einem binären Baum organisiert werden, siehe Abbildung [[#fig:CART_Med_Exa|31]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CART_Med_Exa&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CART_1_MedExa.jpg|460px|thumb|center|Abbildung 31: Ein medizinisches Beispiel für einen Klassifikationsbaum (Quelle: [CARTPennStateCourse(2024)]).]] &amp;lt;span id=&amp;quot;fig:CART_Med_Exa&amp;quot; label=&amp;quot;fig:CART_Med_Exa&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jede Frage bezieht sich auf ein Merkmal (Feature), das eine Variable im Raum der Eingabevektoren darstellt. Solche Variablen sind systolischer Blutdruck, Alter und das Vorhandensein einer Sinustachykardie. Somit verwendet die Aufgabe einen dreidimensionalen Raum der Eingabevektoren, wobei zwei Dimensionen sind kontinuierlich, während die letzte diskret ist (kann nur den Wert logisch wahr oder falsch aufnehmen). Auf diese Weise entspricht jedes Blatt des Binärbaums einem disjunkten Bereich des Raums der Eingabevektoren.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;erstellen-eines-entscheidungsbaums&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Erstellen eines Entscheidungsbaums ===&lt;br /&gt;
&lt;br /&gt;
Der Entscheidungsbaum wird iterativ aufgebaut, wobei in jeder Iteration eine der resultierenden Regionen der vorherigen Iteration in zwei weitere disjunkte Regionen aufgeteilt wird. Jede Region wird normalerweise entlang einer Komponente des Eingabevektors aufgeteilt. Dies entspricht einer Frage wie „Ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j \leq k&amp;lt;/math&amp;gt;, wobei die Aufteilung entlang der &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-ten Komponente der Eingabevektoren durchgeführt wird und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; eine mögliche Position für die Aufteilung ist. Dies wird in Abbildung [[#fig:CART_Split_Steps|32]] veranschaulicht.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CART_Split_Steps&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CART_2p1.jpg|300px|thumb|center|]]&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CART_2p2.jpg|300px|thumb|center|]]&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CART_2p3.jpg|300px|thumb|center|]]&lt;br /&gt;
|}&lt;br /&gt;
Abbildung 32: Veranschaulichung der iterativen Aufteilung des Raums der Eingabevektoren in jedem Schritt entlang einer Komponente des Eingabevektors (Quelle: [CARTPennStateCourse(2024)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dabei ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;X&amp;lt;/math&amp;gt; der gesamte Raum der Eingabevektoren und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;X_i&amp;lt;/math&amp;gt;-s, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i= 1,\ldots&amp;lt;/math&amp;gt; stehen für die einzelnen Regionen des Raums der Eingabevektoren als Ergebnis der aktuellen Aufteilung. Aufgrund der binären Baumdarstellung wächst der Baum in jeder Iteration und jede Region kann auch als Knoten im binären Baum dargestellt werden.&lt;br /&gt;
&lt;br /&gt;
Um den Entscheidungsbaum mittels der oben beschriebenen iterativen Aufteilung zu konstruieren, müssen die Teilaufgaben im Voraus festgelegt werden.&lt;br /&gt;
&lt;br /&gt;
* Auswahl der nächsten Aufteilung (split), d. h. Entscheidung, welcher Knoten (d. h. Region) und wie aufgeteilt werden soll.&lt;br /&gt;
* Bereitstellung eines Abbruchkriteriums (stopping criterion) für das Wachstum des Baums.&lt;br /&gt;
* Zuweisen einer Klasse zu jedem Blatt des endgültigen Baums.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Auswahl der nächsten Aufteilung&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Es besteht der Bedarf an einem Maß, mit deren Hilfe aus allen Kandidaten-Aufteilungen die nächstbeste Aufteilung ausgewählt werden kann. Jeder&amp;lt;br /&amp;gt;&lt;br /&gt;
Kandidaten-Aufteilung kann durch den aufzuteilenden Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; und eine Aufteilung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; angegeben werden, der die für die Aufteilung zu verwendende Komponente des Eingabevektors und seine Position angibt.&lt;br /&gt;
&lt;br /&gt;
Ein häufig verwendetes Maß zur Auswahl der nächstbesten Aufteilung ist das Maß „Goodness of split“ („Güte der Aufteilung“). Die &amp;amp;quot;Goodness of split&amp;amp;quot; einer Kandidaten-Aufteilung kann jedoch berechnet werden, indem die Impurity-Funktion (Unreinheitsfunktion) auf einige Knoten angewendet wird. Daher führen wir zunächst die Impurity-Funktion ein.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Die Impurity-Funktion&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Intuitiv ist eine Region „rein“, wenn die meisten Punkte (d. h. Beispiele der Trainingsdaten) zur selben Klasse gehören. Dazu muss gemessen werden, wie unrein (impure) eine Region ist. Ein Beispiel zum Erstellen reiner Regionen in zwei Aufteilungsschritten ist in Abbildung [[#fig:CART_Clear_Regions|33]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CART_Clear_Regions&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CART_3p1.jpg|800px|thumb|center|]]&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CART_3p2.jpg|800px|thumb|center|]]&lt;br /&gt;
|}&lt;br /&gt;
Abbildung 33: Ein Beispiel zum Erstellen reiner Regionen in zwei Aufteilungsschritten (Quelle: [CARTPennStateCourse(2024)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nach der ersten Aufteilung gehören nur zwei Punkte auf der linken Seite zur durch Kreise gekennzeichneten Klasse. Durch Anwenden der zweiten Teilung ist es möglich, einen Baum mit 100 % reinen Knoten zu erhalten. Man kann beobachten, dass nach jedem Aufteilungsschritt die Reinheit zunimmt oder gleichwertig die Impurity abnimmt.&lt;br /&gt;
&lt;br /&gt;
Seien &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_1, \ldots, p_C&amp;lt;/math&amp;gt; die Wahrscheinlichkeiten, dass ein markierter Datenpunkt in der Region zur Klasse &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1,\ldots, C&amp;lt;/math&amp;gt; gehört. Dann ist die Impurity-Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; auf &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_1, \ldots, p_C&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_c \geq 0&amp;lt;/math&amp;gt; für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c=1,\ldots, C&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{c=1}^C p_c = 1&amp;lt;/math&amp;gt; durch ihre folgenden Eigenschaften definiert:&lt;br /&gt;
&lt;br /&gt;
# Die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; hat ein Maximum nur bei gleichmäßig verteilten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_c&amp;lt;/math&amp;gt;-s, d. h. wenn alle &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_c&amp;lt;/math&amp;gt;-s gleich sind.&lt;br /&gt;
# Die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; hat ein Minimum an Punkten, wenn einer der &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_c&amp;lt;/math&amp;gt;-Werte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; und alle anderen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; sind.&lt;br /&gt;
# Die Funktion &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; ist symmetrisch in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_1, \ldots, p_C&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\phi()&amp;lt;/math&amp;gt; hat für jede Permutation von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_1, \ldots, p_C&amp;lt;/math&amp;gt; den gleichen Wert.&lt;br /&gt;
&lt;br /&gt;
Sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(t)&amp;lt;/math&amp;gt; die Wahrscheinlichkeit, dass ein Punkt (= Featurevektor eines Beispiels einer Trainingsdata) im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; liegt. Ähnlich sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(c,t)&amp;lt;/math&amp;gt; die Wahrscheinlichkeit, dass ein Punkt im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; liegt und zur Klasse &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; gehört. Darüber hinaus sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(c|t)&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c=1,\ldots,C&amp;lt;/math&amp;gt; die bedingte Wahrscheinlichkeit, dass ein Punkt zur Klasse &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; gehört, vorausgesetzt, dass er im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; liegt. Diese bedingten Wahrscheinlichkeiten können basierend auf ihren Definitionen als &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(c|t) = \frac{p(c,t)}{p(t)}&amp;lt;/math&amp;gt; berechnet werden. Dann ist das Impurity-Measure (Unreinheitsmaß) des Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i(t)&amp;lt;/math&amp;gt; als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;i(t) = \phi\left(p(1|t), p(2|t),\ldots, p(C|t)\right)&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
Die am häufigsten verwendeten Impurity-Funktionen sind&lt;br /&gt;
&lt;br /&gt;
# Entropie (entropy): &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{c=1}^C p_c log \frac{1}{p_c}&amp;lt;/math&amp;gt; (For &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_c = 0&amp;lt;/math&amp;gt; apply &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lim_{p_c \rightarrow 0 } p_c log \frac{1}{p_c} = 0&amp;lt;/math&amp;gt;.)&lt;br /&gt;
# Fehlklassifizierungsrate (missclassification rate): &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1-\max_{c}p_c&amp;lt;/math&amp;gt;.&lt;br /&gt;
# Gini-Index (Gini index): &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{c=1}^C p_c(1-p_c) = 1 - \sum_{c=1}^C p_c^2&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Es ist wichtig zu verstehen, dass es egal ist, welche Impurity-Funktion angewendet wird, da ihre Fähigkeit zur Messung der Impurity durch ihre Eigenschaften gewährleistet wird, die für alle Impurity-Funktionen gelten.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Auswahl basierend auf dem Maß „Goodness of split“&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der linke und rechte Kindknoten des Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; werden jeweils als &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_L&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_R&amp;lt;/math&amp;gt; bezeichnet. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(t_L)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(t_R)&amp;lt;/math&amp;gt; bezeichnen die Wahrscheinlichkeit, dass sich ein Punkt im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_L&amp;lt;/math&amp;gt; bzw. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_R&amp;lt;/math&amp;gt; befindet. Dann sind die bedingten Wahrscheinlichkeiten, dass sich ein Punkt im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_L&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_R&amp;lt;/math&amp;gt; befindet, wenn der Punkt im Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; ist, durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp;p_L = \frac{p(t_L)}{p(t)} \\&lt;br /&gt;
&amp;amp;p_R = \frac{p(t_R)}{p(t)}&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; gegeben.&lt;br /&gt;
&lt;br /&gt;
Basierend auf der Definition von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i(t)&amp;lt;/math&amp;gt; kann die „Goodness of split“ einer&amp;lt;br /&amp;gt;&lt;br /&gt;
Kandidaten-Aufteilung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s,t&amp;lt;/math&amp;gt; als die Differenz der Impurity des Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; und der gewichteten Summe der Impurity der linken und rechten untergeordneten Knoten angegeben werden. Mit anderen Worten&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\phi(s,t) = \Delta i(s,t)= i(t) - p_L i(t_L) - p_R i(t_R).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Somit drückt die oben definierte „Goodness of split“ den Gewinn aus, wenn der Kandidaten-Aufteilung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(s,t)&amp;lt;/math&amp;gt; angewendet wird, d. h. wenn die durch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; angegebene Aufteilung auf Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; angewendet wird. Hier sind &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_L&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p_R&amp;lt;/math&amp;gt; Gewichte oder Anteile von Punkten, die zu linken und rechten Knoten gehen.&lt;br /&gt;
&lt;br /&gt;
Die gewichtete Impurity (weighted impurity) des Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; wird definiert als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;I(t) = p(t)i(i).&amp;lt;/math&amp;gt; Dies kann als die Impurity des Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; interpretiert werden, gewichtet mit dem Anteil seiner Punkte im Baum.&lt;br /&gt;
&lt;br /&gt;
Dann wird die Differenz des gewichteten Impurity-Mass des übergeordneten Knotens &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; und der linken und rechten untergeordneten Knoten definiert als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
\Phi(s,t) &amp;amp;= \Delta I(s,t)= I(t) - I(t_L) - I(t_R)= p(t)i(t) - p(t_L)i(t_L) - p(t_R)i(t_R) \\&lt;br /&gt;
&amp;amp;= p(t)i(t) - p(t)p_L i(t_L) - p(t)p_R i(t_R) = p(t)\Delta i(s,t). &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Auswahl basierend auf der Twoing Rule&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eine andere Möglichkeit, die nächste Aufteilung auszuwählen, ist die Anwendung der Twoing Rule. Diese Regel wählt die nächste Aufteilung aus, die den Gesamtunterschied der Posterior-Wahrscheinlichkeiten der Klassen maximiert und die Anteile der Punkte ausgleicht, die auf die untergeordneten Knoten fallen. Mit anderen Worten wählt die Twoing Rule am Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; die Aufteilung aus, die das Optimierungskriterium&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\max_{s}  \frac{p_L p_R}{4}\left(\sum_{c} |p(c|t_L) - p(c|t_R)| \right)^2&amp;lt;/math&amp;gt; erfüllt.&lt;br /&gt;
&lt;br /&gt;
Der Term in der Klammer stellt die Gesamtdifferenz der&amp;lt;br /&amp;gt;&lt;br /&gt;
Posterior-Wahrscheinlichkeiten der Klassen dar, während der Multiplikationsfaktor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\frac{p_L p_R}{4}&amp;lt;/math&amp;gt; im Maximumkriterium das Ausgleichsziel umsetzt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Das Problem des guten Abbruchkriterium&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wenn man die &amp;amp;quot;Goodness of split&amp;amp;quot; zur Auswahl der nächsten Aufteilung anwendet, ist zu erwarten, dass die gewichtete Impurity mit jedem Schritt abnimmt. Der Baum, der durch iterative Auswahl der nächstbesten Aufteilung wächst, ist jedoch ein Greedy Algorithmus. Daher kann auf eine schlechte Aufteilung mit niedrigem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; eine gute Aufteilung mit höherem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; folgen. Daher wäre ein Abbruchkriterium wie das Abbrechen des Wachstums des Entscheidungsbaums, wenn &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; unter einen bestimmten Schwellenwert fällt, kein zufriedenstellendes Abbruchkriterium. Ebenso würde ein „Vorausblick“ auf weitere Schritte in der Entwicklung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; dieses Problem nicht lösen, da die weitere Entwicklung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; nach diesen Schritten unbekannt ist, d. h. eine gute Aufteilung mit höherem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta I(s,t)&amp;lt;/math&amp;gt; könnte auch nach diesen Schritten folgen.&lt;br /&gt;
&lt;br /&gt;
Daher kann auf diese Weise kein gutes Abbruchkriterium festgelegt werden. Deshalb lässt sich die richtige Strategie wie folgt feststellen.&lt;br /&gt;
&lt;br /&gt;
* Lassen den Baum zunächst wachsen, bis er ausreichend groß ist, und&lt;br /&gt;
* Prune (beschneiden) ihn dann gemäß einem zufriedenstellenden Kriterium, siehe Unterabschnitt [[#subsec:prune|4.2.3]].&lt;br /&gt;
&lt;br /&gt;
Das Erreichen einer ausreichend großen Größe kann beispielsweise anhand eines der folgenden Kriterien entschieden werden.&lt;br /&gt;
&lt;br /&gt;
* Lassen den Baum wachsen, bis alle Knoten rein sind (= nur noch eine Klasse enthalten).&lt;br /&gt;
* Lassen den Baum wachsen, bis die Anzahl der Datenpunkte unter eine vordefinierte Grenze fällt, z. B. 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Zuweisen eine Klasse jedem Blatt&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nachdem der Entscheidungsbaum fertig ist, wird jedem Blatt eine Klasse zugewiesen. Die angewandte Regel ist unkompliziert: Jedem Blatt wird die Klasse mit der höchsten Wahrscheinlichkeit zugewiesen. Mit anderen Worten: Die dem Blattknoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; zugewiesene Klasse &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c^*(t)&amp;lt;/math&amp;gt; kann als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;c^*(t) = \arg\max_{c}  p(c|t)&amp;lt;/math&amp;gt; gegeben werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;subsec:prune&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pruning ===&lt;br /&gt;
&lt;br /&gt;
Die Beschreibung des Pruning (Beschneidung) bedarf einiger Vorüberlegungen (preliminary considerations).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Vorüberlegungen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Optimale Teilbäume&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das Finden eines optimalen Teilbaums mittels erschöpfender Suche ist keine praktikable Strategie, da die Anzahl der Teilbäume auch bei einem mittelgroßen Baum beträchtlich groß sein kann. Stattdessen wird eine effizientere Methode benötigt, die die folgenden Voraussetzungen erfüllt.&lt;br /&gt;
&lt;br /&gt;
* Der Teilbaum nach dem Pruning sollte in einem vordefinierten Sinne optimal sein.&lt;br /&gt;
* Die Methode zur Bestimmung dieses optimalen Teilbaums sollte rechnerisch handhabbar sein.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Fehlklassifizierungsrate&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Fehlklassifizierungsrate ist die Wahrscheinlichkeit der Fehlklassifizierung (misclassification) in einem bestimmten Blattknoten, welche durch die Resubstitutionsschätzung (resubstitution estimate) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(t)&amp;lt;/math&amp;gt; charakterisiert wird. Aufgrund der Klassenzuweisungsregel (class assign rule), dass jedem Blatt die Klasse mit der höchsten Wahrscheinlichkeit zugewiesen wird, ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;r(t)&amp;lt;/math&amp;gt; gegeben als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;r(t) = 1- p(c^*(t)|t) = 1 - \max_{c}  p(c|t).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wir definieren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(t)= r(t)p(t)&amp;lt;/math&amp;gt;. Seien &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\tilde{T}&amp;lt;/math&amp;gt; die Bezeichnungen des gesamten Baums bzw. der Menge der Blattknote. Der Klassifizierungsfehler für den gesamten Baum, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(T)&amp;lt;/math&amp;gt;, ist definiert als die Summe der gewichteten Resubstitutionsschätzung über die Menge der Blattknoten, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\tilde{T}&amp;lt;/math&amp;gt;, mit anderen Worten &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R(T) = \sum_{t \in \tilde{T}} R(t) = \sum_{t \in \tilde{T}} r(t)p(t).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eine wesentliche Aussage ist, dass die Aufteilung eines Knotens in zwei Kindknoten immer den Klassifizierungsfehler für den gesamten Baum verringert. Dies folgt aus &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R(t) \geq R(t_L) + R(t_LR),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
welches eine Folge der Klassenzuweisungsregel ist und kann wie folgt nachgewiesen werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
p(c^*(t)|t) &amp;amp;= p(c^*(t), t_L|t) + p(c^*(t), t_R|t) = p(c^*(t)| t_L)p(t_L|t) + p(c^*(t)|t_R)p(t_R|t) \\&lt;br /&gt;
&amp;amp;= p(c^*(t)| t_L)p(t_L|t) + p(c^*(t)|t_R)p(t_R|t) = p_L p(c^*(t)| t_L) + p_R p(c^*(t)|t_R) \\&lt;br /&gt;
&amp;amp;\leq p_L \max_{c}  p(c|t_L) + p_R \max_{c}  p(c|t_R). &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Daher gilt &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
r(t) &amp;amp;= 1- p(c^*(t)|t) \geq 1 - \left(p_L \max_{c}  p(c|t_L) + p_R \max_{c}  p(c|t_R) \right) \\&lt;br /&gt;
&amp;amp;= p_L \left(1-\max_{c}  p(c|t_L)\right) + p_R \left(1-\max_{c}  p(c|t_R)\right)= p_L r(t_L) + p_R r(t_R), &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
aus denen &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
R(t) &amp;amp;= p(t)r(t) \geq p(t) p_L r(t_L) + p(t) p_R r(t_R) \\&lt;br /&gt;
&amp;amp;= p(t_L)r(t_L) + p(t_R)r(t_R) = R(t_L)+R(t_R)&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; folgt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Minimal Cost-Complexity Pruning&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Begriffe und Notationen&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zur Beschreibung des Prunings werden verschiedene Begriffe und Notationen eingeführt.&lt;br /&gt;
&lt;br /&gt;
* Descendant (Nachkomme): Ein Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_2&amp;lt;/math&amp;gt; ist ein Descendant von Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt;, wenn es einen Pfad von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; nach unten im Baum zu Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_2&amp;lt;/math&amp;gt; gibt.&lt;br /&gt;
* Ancestor (Vorfahr): &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; ist Ancestor von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_2&amp;lt;/math&amp;gt;, wenn &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_2&amp;lt;/math&amp;gt; ein Descendant von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; ist.&lt;br /&gt;
* Branch (Zweig) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_t&amp;lt;/math&amp;gt; des Baums &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; mit Wurzelknoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in T&amp;lt;/math&amp;gt;: besteht aus Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; und allen seinen Descendants.&lt;br /&gt;
* Pruning a branch (Das Beschneiden eines Zweigs) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_t&amp;lt;/math&amp;gt; aus einem Baum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; bedeutet das Löschen aller Knoten des Zweigs &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_t&amp;lt;/math&amp;gt;, außer dem Wurzelknoten.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Kosten-Komplexität-Kriterium (cost-complexity criterion) zum Finden des optimalen Teilbaums&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Klassifizierungsfehler &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R(T)&amp;lt;/math&amp;gt; ist kein geeignetes Maß, um den optimalen Teilbaum (optimal subtree) zu finden, da er mit zunehmendem Baum monoton abnimmt und somit den größten Baum bevorzugt. Das Hinzufügen eines Strafterms (penalty term), der kleinere Bäume bevorzugt, führt jedoch zu einem ausgewogenen Maß (balanced measure), dessen Minimierung zum Finden des optimalen Teilbaums geeignet ist.&lt;br /&gt;
&lt;br /&gt;
Sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|\tilde{T}|&amp;lt;/math&amp;gt; die Anzahl der Blattknoten in der Menge &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\tilde{T}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; ein Komplexitätsparameter (complexity parameter). Die Kosten-Komplexität (cost-complexity) eines Baums &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; ist durch&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R_{\eta}(T) = R(T) + \eta |\tilde{T}|&amp;lt;/math&amp;gt; definiert.&lt;br /&gt;
&lt;br /&gt;
Weiterhin sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; der initiale Baum (initial tree), der durch Wachstum auf eine ausreichend große Größe erhalten wird, und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\hat{T}&amp;lt;/math&amp;gt; die Menge der Teilbäume des Baums &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt;. Dann soll der optimale Teilbaum eine minimale Kosten-Komplexität aufweisen &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\arg\min_{T \in \hat(T_0)} R_{\eta}(T) = \min_{T \in \hat(T_0)} \left(R(T) + \eta |\tilde{T}|\right).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Hier begünstigt der Strafterm &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta |\tilde{T}|&amp;lt;/math&amp;gt; in der Zielfunktion (objective function) kleinere Bäume und der Komplexitätsparameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; gibt die Wichtigkeitsgewichtung (importance weight) der Größe des Baums an.&lt;br /&gt;
&lt;br /&gt;
Es kann vorkommen, dass mehrere Teilbäume dieselbe minimale&amp;lt;br /&amp;gt;&lt;br /&gt;
Kosten-Komplexität aufweisen, z. B. einer mit kleinerer Größe, aber höherem Klassifizierungsfehler. In diesem Fall wird der Teilbaum mit der kleinsten Größe bevorzugt. Daher kann der optimale Teilbaum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T^*(\eta)&amp;lt;/math&amp;gt; als der mit der minimalen Größe unter der Teilbäume mit minimaler Kosten-Komplexität angegeben werden. Es kann wie folgt als Optimierungsproblem formuliert werden. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
T^*(\eta) &amp;amp;= \arg\min_{T \in \hat{T}_0} R_{\eta}(T) = \arg\min_{T \in \hat{T}_0} \left(R(T) + \eta |\tilde{T}|\right), \\&lt;br /&gt;
|T^*(\eta)| &amp;amp;\leq T(\eta) \mathrm{\ \ }\mathrm{~fuer~alle~} \mathrm{\ \ } T(\eta) \mathrm{~mit~} T(\eta) = T^*(\eta).&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Da es nur endlich viele Teilbäume des Baums &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; gibt, ergibt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T^*(\eta))&amp;lt;/math&amp;gt; nur für endlich viele &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt;-s unterschiedliche Werte. Daher ist &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T^*(\eta))&amp;lt;/math&amp;gt; als Funktion von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; eine stückweise Treppenfunktion mit Sprüngen (piecewise step function with jumps).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ \ }&amp;lt;/math&amp;gt; Weakest-Link-Cutting&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wir erweitern die Definition der Kosten-Komplexität vom Baum auch auf Knoten. Für den Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in T&amp;lt;/math&amp;gt; ist seine Kosten-Komplexität als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;R_{\eta}(t) = R(t) + \eta&amp;lt;/math&amp;gt; definiert.&lt;br /&gt;
&lt;br /&gt;
Die Weakest-Link-Cutting-Methode bestimmt den optimalen Teilbaum durch Durchlaufen der optimalen Teilbäume &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T^*(\eta))&amp;lt;/math&amp;gt; als Funktion von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta=0&amp;lt;/math&amp;gt; bis &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta=1&amp;lt;/math&amp;gt;, indem sie den nächsten Sprungpunkt (jump point) in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; rekursiv bestimmt. Das Durchlaufen der optimalen Teilbäume erfordert für jeden Knoten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; den Vergleich von&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
R_{\eta}(t) &amp;amp;= R(t) + \eta \mathrm{\ \ }\mathrm{~und~} \\&lt;br /&gt;
R_{\eta}(T_t) &amp;amp;= R(T_t) + \eta |\tilde{T}_t|.&lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Beginnend mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta=0&amp;lt;/math&amp;gt; wissen wir bereits, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{0}(T_t) &amp;lt; R_0(t)&amp;lt;/math&amp;gt; für jedes &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \in T_0&amp;lt;/math&amp;gt;, d.h. der optimale Teilbaum für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta =0&amp;lt;/math&amp;gt; ist der initiale Baum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; selbst. Diese Ungleichung gilt auch für einige kleine &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt;. Durch schrittweises Erhöhen von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; wird der Punkt erreicht, an dem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T_t) = R_{\eta}(t)&amp;lt;/math&amp;gt;, da der Koeffizient von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T_t)&amp;lt;/math&amp;gt; größer als in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(t)&amp;lt;/math&amp;gt; ist. Der Wert von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; an diesem Punkt kann aus der Gleichheit bestimmt werden, was zum Wert&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\frac{R(t) - R(T_t)}{|\tilde{T}_t|-1}.&amp;lt;/math&amp;gt; an diesem Gleichheitspunkt (equality point) führt.&lt;br /&gt;
&lt;br /&gt;
Direkt über diesem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; ist der Wert &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T_t) &amp;gt; R_{\eta}(t)&amp;lt;/math&amp;gt;, was bedeutet, dass das Pruning des Zweigs &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_t&amp;lt;/math&amp;gt; zu einem Teilbaum mit geringerer Kosten-Komplexität führt. Es kann jedoch vorkommen, dass dieser Gleichheitspunkt für einen anderen Knoten früher erreicht wird, d. h. bei geringerem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt;. Daher tritt der erste Sprung in minimaler Kosten-Komplexität, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T^*(\eta))&amp;lt;/math&amp;gt;, am Gleichheitspunkt mit dem kleinsten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; unter den Gleichheitspunkten aller Nicht-Blattknoten (non-leaf nodes) des Baums &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; auf. Der Wert von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; an diesem Sprungpunkt von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;R_{\eta}(T^*(\eta))&amp;lt;/math&amp;gt; wird mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_1&amp;lt;/math&amp;gt; bezeichnet und kann wie folgt berechnet werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\eta_1 = \min_{t \in T_0\ \tilde{T}_0} \frac{R(t) - R(T_t)}{|\tilde{T}_t|-1}.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t_1&amp;lt;/math&amp;gt; der Knoten, an dem diese erste Gleichheit auftritt, mit anderen Worten &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;t_1 = \arg\min_{t \in T_0\ \tilde{T}_0} \frac{R(t) - R(T_t)}{|\tilde{T}_t|-1}.&amp;lt;/math&amp;gt; Then just above &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_1&amp;lt;/math&amp;gt; the optimal subtree, i.e. the subtree with the smallest cost-complexity is the one, which is obtained by pruning the branch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_{t_1}&amp;lt;/math&amp;gt; from &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt;, which is denoted as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_1= T_0 \ T_{t_1}&amp;lt;/math&amp;gt;. Repeating the gradually increase of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; and the computation of the next jump point based on the cost-complexity of the actual optimal subtree, a recursive algorithm can be defined to obtain the jump points &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_i&amp;lt;/math&amp;gt; and the optimal subtrees in the individual &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; regions. In each step the algorithm prunes the branch, whose cost-complexity becomes larger than the one of its root node at earliest in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt;, which can be seen as the weakest-link. That is why the algorithm is called weakest-link cutting algorithm. Its schematic operation is given in Algorithm .&lt;br /&gt;
&lt;br /&gt;
Dann ist knapp über &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_1&amp;lt;/math&amp;gt; der optimale Teilbaum, d. h. der Teilbaum mit der geringsten Kosten-Komplexität, derjenige, der durch Pruning den Zweig &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_{t_1}&amp;lt;/math&amp;gt; von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; erhalten wird, was als &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_1= T_0 \ T_{t_1}&amp;lt;/math&amp;gt; bezeichnet wird. Durch Wiederholen der schrittweisen Erhöhung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; und der Berechnung des nächsten Sprungpunkts basierend auf der Kosten-Komplexität des aktuell optimalen Teilbaums kann ein rekursiver Algorithmus definiert werden, um die Sprungpunkte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_i&amp;lt;/math&amp;gt; und die optimalen Teilbäume in den einzelnen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt;-Regionen zu erhalten. In jedem Schritt führt der Algorithmus das Pruning den Zweig durch, dessen Kostenkomplexität in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta&amp;lt;/math&amp;gt; am frühesten größer wird als die seines Wurzelknotens, der als Weakest-Link (schwächstes Glied) angesehen werden kann. Aus diesem Grund wird der Algorithmus als Weakest-Link-Cutting-Algorithmus (Algorithmus zum Beschneiden des schwächsten Glieds) bezeichnet. Seine schematische Funktionsweise ist im Algorithmus  angegeben.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Algorithm  Weakest-Link-Cutting-Algorithmus&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
Eingabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- der initiale Baum &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_0&amp;lt;/math&amp;gt; Ausgabe:&amp;lt;br /&amp;gt;&lt;br /&gt;
- Folge von Sprungpunkten &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_i&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 1&amp;lt;/math&amp;gt;, - Folge von optimalen Teilbäumen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_i&amp;lt;/math&amp;gt; in den einzelnen Regionen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[\eta_{i} - \eta_{i+1})&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 0&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_0 =0&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1 Initialisierung: &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_{act} = T_0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_{act} = 0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_{next} = 0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ \ }&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta[]=0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t[]=0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T[]=0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta[0]=0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T[0]=T_0&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
2 while &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_{next} &amp;lt; 1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
3    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta \eta = \min_{t \in T_{act}\ \tilde{T}_{act}} \frac{R(t) - R(T_t)}{|\tilde{T}_t|-1}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
4    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_{next} = \eta_{act} + \Delta \eta&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
5    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta[i]=\eta_{next}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
6    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t[i] = \arg\min_{t \in T_{act}} \ \tilde{T}_{act} \frac{R(t) - R(T_t)}{|\tilde{T}_t|-1}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
7    &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T[i]= T_{act} \ T_{t[i]}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
8    Update &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_{act} = T[i]&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\eta_{act} = \eta_{next}&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
9    Inkrement &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt; as &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i=i+1&amp;lt;/math&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
10 end&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;—————————————————————————————&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;eigenschaften-des-entscheidungsbaums&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Eigenschaften des Entscheidungsbaums ===&lt;br /&gt;
&lt;br /&gt;
Ein wesentliches Merkmal des Entscheidungsbaumansatzes (decision tree approach) ist, dass der Raum seiner Eingabevektoren explizit vorgegeben ist, d. h. die Dimensionen der Eingabevektoren sind explizit bekannt. Dies ist ein wesentlicher Unterschied zu HMMs oder neuronalen Netzwerken, deren Eingabevektoren (=Featurevektoren) implizit bestimmt werden.&lt;br /&gt;
&lt;br /&gt;
Nachfolgend wird eine Liste über die Vorteile des Entscheidungsbaumansatzes angeführt.&lt;br /&gt;
&lt;br /&gt;
* Der Entscheidungsbaumansatz verarbeitet nicht nur Ordinalvariablen (Ordinalskala), sondern auch kategorische Variablen (Nominalskala).&lt;br /&gt;
* Der Entscheidungsbaumansatz ist invariant gegenüber monotonen Transformationen der Featurekomponenten als Ordinalvariablen.&lt;br /&gt;
* Der Entscheidungsbaumansatz liefert eine Schätzung der Fehlklassifizierungsrate für jede Klasse.&lt;br /&gt;
* Der Entscheidungsbaum ist robust gegenüber fehlklassifizierten Punkten (misclassified points) im Trainingsdaten und Ausreißern (outliers).&lt;br /&gt;
* Der Entscheidungsbaum ist leicht zu interpretieren, was ihn insbesondere in medizinischen Anwendungsszenarien attraktiv macht.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;subsub:RF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Random Forest ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Bootstrap-Aggregation - Bagging&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das bisher besprochene Training ist ein deterministischer Prozess, der dieselben Parameter aus demselben Trainingsdaten ergibt. Ein anderer Ansatz besteht darin, eine zufällige Komponente in den Trainingsprozess einzuführen und mehrere Durchläufe desselben Trainingsdaten mit dem zufällig modifizierten Trainingsprozess durchzuführen. Eine solche zufällige Modifikation kann beispielsweise darin bestehen, in jedem Durchgang eine zufällig ausgewählte Teilmenge der Trainingsdaten zu nehmen und nur diese Teilmenge für das Training in diesem Durchgang zu verwenden. Die Ergebnisse nach jedem Durchgang werden angesammelt und das Endergebnis wird aus der Sammlung der Ergebnisse durch eine zweckmäßige Kombination erstellt. Hier sind die Ergebnisse beispielsweise die Parameter des Modells. Die Kombination der angesammelten Ergebnisse kann beispielweise durch Mittelwertbildung (by averaging), gewichtete Mittelwertbildung (by weighted averaging), Berechnung des Medians (computing the median) oder durch Anwendung einer Mehrheitswahl (majority voting) erfolgen. Dieser Ansatz wird als Bootstrap-Aggregation genannt oder mit dem Akronym Bagging bezeichnet.&lt;br /&gt;
&lt;br /&gt;
Das Ziel von Bagging ist normalerweise, die Varianz im Ergebnis zu verringern. Die Varianz des Stichprobenmittelwerts nimmt proportional zur Anzahl der Stichproben ab und daher das Ansammlung und Mittelwertbildung mehrerer Ergebnisse eine reduzierende Wirkung auf die Varianz hat.&lt;br /&gt;
&lt;br /&gt;
Bootstrap-Aggregation hat mehrere Vorteile.&lt;br /&gt;
&lt;br /&gt;
* Die Mittelung über eine Sammlung trainierter Parameter reduziert Overfitting, da sie die erfasste Entwicklung zwischen den Trainingsbeispielen, die von der zugrunde liegenden Verteilung abweichen, teilweise aufhebt.&lt;br /&gt;
* Die Mittelung über eine Sammlung trainierter Parameter führt zu einem stabileren Endergebnis.&lt;br /&gt;
* Modelle mit hoher Kapazität können aufgrund der reduzierten Overfitting eine flexiblere Anpassung (fitting) erreichen.&lt;br /&gt;
* Die Mittelung über eine Sammlung trainierter Parameter führt zum Aufbrechen des Bias-Varianz-Kompromisses (siehe in Absatz [[#subsec:bias_variance|[subsec:bias_variance]]]), indem die Varianz neben dem gleichen Bias reduziert wird.&lt;br /&gt;
&lt;br /&gt;
Bootstrap-Aggregation wurde von Leo Breiman [Breiman(1996)] entwickelt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Random Forest&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Random Forest ist eine Bootstrap-Aggregation, die auf Klassifizierungs- und Regressionsbäume angewendet wird. In Random Forest werden mehrere Bäume trainiert. Während des Trainings jedes Baums wird nur eine zufällig ausgewählte Teilmenge von Komponenten des Eingabevektoren berücksichtigt, die für die Aufteilung verwendet wird.&lt;br /&gt;
&lt;br /&gt;
Leo Breiman hat umfangreiche Experimente mit Random Forest durchgeführt. Er fand heraus, dass es insgesamt etwas besser abschneidet als Support Vector Machines.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;convolutional-neural-networks-für-bildverarbeitung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Convolutional Neural Networks für Bildverarbeitung ==&lt;br /&gt;
&lt;br /&gt;
Convolutional Neural Networks (CNNs) sind eine Subklasse von KNNs, die sich für die Verarbeitung von Eingaben in Gridform, insbesondere von Bildern, eignen. Die Convolutional im Namen von CNN ergibt sich aus der Convolution Layer, die den Kernbaustein von CNN ist. Der Convolution Layer realisiert einen mathematischen Convolution (= Faltungsoperation). CNNs eignen sich besonders zum Extrahieren lokales Features und komplexerer Muster wie Texturen (textures). Hier lokal bedeutet, dass diese Features nur von den Pixeln abhängen, die sich um das betrachtete Pixel herum befinden.&lt;br /&gt;
&lt;br /&gt;
Als Beispiel nehmen wir ein Feature, das durch Subtrahieren des Werts des linken Nachbarpixels vom Wert jedes einzelnen Pixels erstellt wird. Diese Funktion eignet sich zur Erkennung von Konturen, genauer gesagt von Kanten mit vertikalen Komponenten, was eine mögliche Teilaufgabe der Objekterkennung darstellt. Dies ist in Abbildung [[#fig:CNN_9.6|34]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.6&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_9.6.jpg|460px|thumb|center|Abbildung 34: Vertikale Kantenerkennung (Quelle: [Goodfellow et al.(2016)]).]] &amp;lt;span id=&amp;quot;fig:CNN_9.6&amp;quot; label=&amp;quot;fig:CNN_9.6&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Das Bild auf der rechten Seite zeigt die Anwendung des Feature zur Konturerkennung auf das Originalbild auf der linken Seite.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;die-mathematische-convolution&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Die mathematische Convolution ===&lt;br /&gt;
&lt;br /&gt;
Die stetige Version des Faltungsoperators ist ein Integral einer Multiplikation zweier Funktionen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x(\tau)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w(t-\tau)&amp;lt;/math&amp;gt;, über die reellwertige Variable &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\tau&amp;lt;/math&amp;gt; als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;s(t) = \int x(\tau) w(t-\tau) d\tau.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das resultierende Integral hängt nur von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; ab. Solche Operatoren kommen in vielen technischen Teilgebieten vor, wie z.B. Beschreiben der Wahrscheinlichkeitsdichtefunktion der Summe zweier unabhängiger Zufallsvariablen mit den Wahrscheinlichkeitsdichtefunktionen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x(t)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w(t)&amp;lt;/math&amp;gt; oder Entrauschen des Signals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x(t)&amp;lt;/math&amp;gt; durch Bildung seines gewichteten Durchschnitts durch Anwendung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; abhängige Gewichte &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w(t)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Das Argument des Integrals reicht in seiner allgemeinsten Form von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-\infty&amp;lt;/math&amp;gt; bis &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt;, hängt aber normalerweise vom Kontext ab. Im Beispiel pdf der Summe unabhängiger nicht negativer Zufallsvariablen geht das Integral von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; bis unendlich, während im zweiten Beispiel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; die Zeit darstellen kann und das Integral von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; bis &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; geht. Werte für &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\tau &amp;gt; t&amp;lt;/math&amp;gt; zu haben, würde bedeuten, auch zukünftige Werte des Signals &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x(\tau)&amp;lt;/math&amp;gt; in die Berechnung des entrauschten Werts bei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s(t)&amp;lt;/math&amp;gt;, einzubeziehen, was normalerweise im realen Kontext nicht möglich ist.&lt;br /&gt;
&lt;br /&gt;
Die Convolution wird in der Regel mit einem Sternchen bezeichnet. &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;s(t) = (x*w)(t) ~  \mathrm{~oder~vereinfacht~} s=x*w.&amp;lt;/math&amp;gt; Die erste und die zweite Funktion, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x(t)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w(t)&amp;lt;/math&amp;gt; werden als Eingabe und Kernel bezeichnet. Die Ausgabefunktion, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s(t)&amp;lt;/math&amp;gt;, wird im neuronalen Netzwerkkontext auch als Feature-Map genannt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Die diskrete Convolution&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die diskrete Convolution ist analog definiert und kann als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;s(n) = \sum_{m=-\infty}^{\infty} x(m) w(n-m)&amp;lt;/math&amp;gt; angegeben werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Die zweidimensionale Convolution&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Convolution kann auch als mehrdimensionaler Operator definiert werden. Die zweidimensionale diskrete Convolution kann wie folgt angegeben werden: &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;S(n,m) = (I*K)(n,m)= \sum_{i}\sum_{j} I(i,j) K(n-i,m-j).&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bei Anwenden auf ein Bild, beschreibt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;I&amp;lt;/math&amp;gt; das zweidimensionale Bild und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; ist ein zweidimensionaler Kernel. Beide werden als zweidimensionales endliches Array dargestellt und die resultierende Matrix, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S(n,m)&amp;lt;/math&amp;gt; wird als Ausgabematrix genannt. In diesem Fall können die Funktionen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;I(n,m)&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K(n,m)&amp;lt;/math&amp;gt; in der oben angeführten Formel mit Ausnahme einer endlichen Menge von Punkten als Null angenommen werden. Auf diese Weise kann die unendliche Summe in der Convolution tatsächlich eine endliche Summe auch darstellen. Mehrdimensionale Arrays werden auch als Tensoren bezeichnet.&lt;br /&gt;
&lt;br /&gt;
Die Convolution ist ein kommutativer Operator, was bedeutet, dass &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S(n,m)&amp;lt;/math&amp;gt; auch als &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;S(n,m) = (K*I)(n,m)= \sum_{i}\sum_{j} I(n-i,m-j)K(i,j)&amp;lt;/math&amp;gt; angegeben werden kann. Dies kann gezeigt werden, wenn den Umtausch &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(n-i) \rightarrow i&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(m-j) \rightarrow j&amp;lt;/math&amp;gt; im Expression von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(I*K)(n,m)&amp;lt;/math&amp;gt; mit Summierung über &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;-\infty&amp;lt;/math&amp;gt; zu &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\infty&amp;lt;/math&amp;gt; durchgeführt werden. Dieser Ausdruck von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;S(n,m)&amp;lt;/math&amp;gt; wird auch als Form mit Kernel-Flipping bezeichnet. Normalerweise ist dies die Form, die im ML-Kontext implementiert wird.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Illustration der Convolution&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Anwendung der zweidimensionalen Convolution lässt sich anhand der Form mit Kernel-Flipping veranschaulichen. Die Gewichte werden in einem Kernelfenster angeordnet (d.h. die Elemente von K()) und auf das Bildfeld des Pixels angewendet, über denen das Kernelfenster positioniert ist. Dies ergibt einen Wert der Ausgabe. Durch horizontales und vertikales Verschieben des Kernelfensters über alle möglichen Positionen ergeben sich alle Werte des Ausgabetensors. Dies wird in Abbildung [[#fig:CNN_conv_oper|35]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_conv_oper&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_conv_oper.jpg|460px|thumb|center|Abbildung 35: Illustration der 2D-Convolution anhand des Kernelfensters basierend auf der Form mit Kernel-Flipping (Quelle: [Reynolds(2021)]).]] &amp;lt;span id=&amp;quot;fig:CNN_conv_oper&amp;quot; label=&amp;quot;fig:CNN_conv_oper&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
 Beispielsweise kann die Convolution der vertikalen Kantenerkennung, die in Abbildung [[#fig:CNN_9.6|34]] illustriert wurde, mit dem in Abbildung [[#fig:CNN_own_1|36]] dargestellten Kernelfenster realisiert werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_own_1&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:kernel_matrix_vertical_edge_detection.jpg|460px|thumb|center|Abbildung 36: Kernelfenster der vertikalen Kantenerkennung.]] &amp;lt;span id=&amp;quot;fig:CNN_own_1&amp;quot; label=&amp;quot;fig:CNN_own_1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;motivation-aus-rechnerischer-sicht&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Motivation aus rechnerischer Sicht ===&lt;br /&gt;
&lt;br /&gt;
Die Anwendung der Convolution in NN ist auch aus rechnerischer Sicht vorteilhaft. Die rechnerischen Vorteile der Verwendung der Convolution in NNs zum Extrahieren lokaler Features können wie folgt aufgeführt werden:&lt;br /&gt;
&lt;br /&gt;
* Sparse Connectivity (dünn besetzte Konnektivität),&lt;br /&gt;
* Parameter-Sharing und&lt;br /&gt;
* Äquivarianz zu verschieben (eqivariance to shift).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Sparse Connectivity&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Lokale Features werden nur durch eine begrenzte Anzahl benachbarter Pixel beeinflusst. Bei seiner Realisierung ist jede Einheit der nächsten Layer nur mit einigen Einheiten der tatsächlichen Layer verbunden. Wenn jede Einheit der nächsten Layer nur mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; der &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; Einheiten der tatsächlichen Layer verbunden ist, verringert sich die erforderliche Anzahl von Operationen an jeder Einheit der nächsten Layer ebenfalls um &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(n)&amp;lt;/math&amp;gt; zu &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathcal{O}(k)&amp;lt;/math&amp;gt;. Dies ist eine große Errungenschaft, da &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; normalerweise mehrere Größenordnungen kleiner als &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; sein kann. Diese Sparse Connectivity, sowohl von unten als auch von oben betrachtet, ist in Abbildung [[#fig:CNN_9.2_9.3|37]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.2_9.3&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CNN_9.2.jpg|460px|thumb|center|]]&lt;br /&gt;
| style=&amp;quot;text-align: left;&amp;quot;| [[Datei:CNN_9.3.jpg|460px|thumb|center|]]&lt;br /&gt;
|}&lt;br /&gt;
Abbildung 37: Sparse Connectivity von unten (Links) und von oben (Rechts) (Quelle: [Goodfellow et al.(2016)]).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In einem tiefen CNN mit mehr Hidden Layer können die tieferen Hidden Layer jedoch indirekt mit mehr Eingabeeinheiten interagieren. Dies ist in Abbildung [[#fig:CNN_9.4|38]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.4&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_9.4.jpg|460px|thumb|center|Abbildung 38: Der rezeptive Bereich der Einheiten in tieferen Hidden Layer (Quelle: [Goodfellow et al.(2016)]).]] &amp;lt;span id=&amp;quot;fig:CNN_9.4&amp;quot; label=&amp;quot;fig:CNN_9.4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Parameter-Sharing&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Verwendung der Convolution in NN bedeutet, dass auch für Bildfelder von mehreren Pixels dieselben Gewichte angewendet werden, siehe Abbildung [[#fig:CNN_conv_oper|35]] im Falle von 2-D-Convolution. Dies wird als Parameter-Sharing bezeichnet. In einem Fully-Connected neuronalen Netzwerkmodell wird jeder Gewichtungsparameter nur einmal verwendet, um genau eine Eingabeeinheit zu gewichten und nur einen Ausgabewert zu berechnen. Im Convolutional Neuronalen Netzen wird jedes Gewicht im Kernel für jede Eingabeeinheit verwendet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Äquivarianz zu verschieben&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Äquivarianz von Convolution und Verschiebung bedeutet, dass der Umtausch der Reihenfolge von Convolution und Verschiebung das Ergebnis nicht ändert. Daraus folgt, dass die Anwendung desselben Convolution Kernel auf ein verschobenes Bild zur gleichen Ausgabe führt, jedoch verschoben. Daher können Teilaufgaben wie z.B. die Konturerkennung mit den gleichen Gewichtsparametern (d. h. mit den gleichen lokalen Features) im gesamten Bild unabhängig von der verschobenen Position des Objekts durchgeführt werden. Somit die Einführung eines neuen lokalen Features wegen der Verschiebung des Bildes ist nicht erforderlich. Aber die Convolution hat keine Äquivarianz zu anderen Transformationen wie der Drehung oder Skalierung eines Bildes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;pooling&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pooling ===&lt;br /&gt;
&lt;br /&gt;
Jedes Element des Ausgabetensors der Convolution liefert einen Wert über das lokale Feature, das der Kernel an dieser Position realisiert. Pooling reduziert die Dimensionen der Ausgabe, indem die Ausgaben von Clustern neuronaler Einheiten zu einer Ausgabe kombiniert werden. Dies kann auch als eine zusammenfassende Statistik gesehen werden.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Typische Pooling Operationen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zu den typischen Pooling Operationen gehören Max-Pooling, Average-Pooling, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^2&amp;lt;/math&amp;gt;-Norm-Pooling oder Weighted-Average-Pooling. Max-Pooling liefert die maximale Ausgabe unter den benachbarten Positionen innerhalb eines rechteckigen Bereichs. Dies ist beispielsweise bei der Konturerkennung sinnvoll, um den schärfsten Unterschied zwischen den benachbarten Pixelwerten extrahieren, der die wahrscheinlichste Position der Kontur darstellt. Das Average-Pooling gibt den Durchschnitt der Ausgaben innerhalb eines rechteckigen Bereichs um die betrachtete Position zurück. Dies ist sinnvoll, z.B. bei Teilaufgaben wie der Einstufung eines bestimmten lokalen Feature, bei dem die räumliche Dichte der größeren Ausgabewerte dieses lokalen Feature proportional zum ausgabenden Wert ist. Ebenso bezieht sich die Norm &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^2&amp;lt;/math&amp;gt; auch auf die Ausgaben innerhalb eines rechteckigen Bereichs um die betrachtete Position. Das Weighted-Average-Pooling berechnet gewichtete Summen unter Anwendung von Gewichtungen basierend auf der Entfernung von der betrachteten Position.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Lerninvarianz&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pooling kann zum Lernen der skaleninvarianten und/oder orientierungsinvarianten Detektion von Features verwendet werden. Dies wird dadurch realisiert, dass Pooling auf separat parametrisierte Convolutionen angewendet wird. Dies ist für den Fall der Zeichenerkennung von Zahlen mit unterschiedlichen Orientierungen in Abbildung [[#fig:CNN_9.9|39]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.9&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_9.9.jpg|460px|thumb|center|Abbildung 39: Erlernen des Erkennens des Zahlzeichens ,5“ invariant zu seiner Position (Quelle: [Goodfellow et al.(2016)]).]] &amp;lt;span id=&amp;quot;fig:CNN_9.9&amp;quot; label=&amp;quot;fig:CNN_9.9&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Jede Einheit der Convolution Layer (Convolution Unit) ist parametrisiert, um eine große Ausgabe für unterschiedlich positionierte Zahlenzeichen „5“ zu liefern. Die Versorgung einer Max-Pooling-Einheit mit diesen Ausgaben führt zu einer großen Ausgabe für jedes der unterschiedlich positionierten Zahlenzeichen „5“. Basierend auf das Label „5“ kann das Modell darauf trainiert werden, das Zahlenzeichen „5“ zu erkennen, das von seiner Position abhängt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;convolution-block&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Convolution Block ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Nichtlineare Aktivierungsfunktion&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Ausgabe jeder Convolution Unit durchläuft normalerweise eine nichtlineare Aktivierungsfunktion (nonlinear activation function), bevor sie zur Einheit der Pooling Layer (Pooling Unit) gelangt. Die nichtlineare Aktivierungsfunktion führt zumindest annähernd eine Abbildung eines bestimmten Eingabebereichs auf einen Ausgabewert (z.B. 0 oder 1) durch. Dies kann so gesehen werden, dass einige Eingabewerte gezwungen werden, sich einem vordefinierten Ausgabewert anzunähern, wodurch im Wesentlichen eine Polarisierung oder Detektorfunktionalität (detection functionality) realisiert wird. Eine der am häufigsten verwendeten nichtlinearen Aktivierungsfunktionen in CNN ist die Rectified Linear Unit, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;ReLU(z)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Zusammensetzung eines Convolution Blocks&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ein typischer Convolution Block besteht aus drei Komponenten, in der folgenden Reihenfolge.&lt;br /&gt;
&lt;br /&gt;
# Convolutional Layer&lt;br /&gt;
# Detektor Layer (=Nichtlineare Aktivierungsfunktion)&lt;br /&gt;
# Pooling Layer&lt;br /&gt;
&lt;br /&gt;
In Diagrammen von CNN-Architekturen werden die Nichtlineare Aktivierungsfunktion oft mit Convolutional Layer zusammen in einem gemeinsamen rechteckigen Box dargestellt. In der sogenannten komplexen Layer-Terminologie werden die drei Komponenten als „Stages“ genannt und die Komponente zusammen als Convolutional Layer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;weitere-typische-layers-eines-cnns&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Weitere typische Layers eines CNNs ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Flatten Layer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Flatten Layer wird benötigt, um die Ausgabenwerten in 2D-Matrixform in einen Vektor umzuwandeln, der die Einspeisung in die Dense Layer ermöglicht. Diese Layer hat keine Parameter zu trainieren.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Dense Layer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Dense Layer (dichte Schicht) ist eine Fully-Connected Layer (vollständig verbundene Schicht), also jede ihrer Einheiten mit der Ausgaben aller Einheiten der vorherigen Layer verbunden ist. Die Dense Layer lernt, die Features auf hohem Abstraktionsniveau aus den Convolution Blocks zu kombinieren, um die Klassifizierungsaufgabe zu erfüllen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Dropout layer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Dropout Layer realisiert eine so genannte Regularisierungstechnik ([https://en.wikipedia.org/wiki/Regularization_(mathematics) regularization technique]), um die Overfitting zu reduzieren. Sie wendet Dropout an, bei dem die Ausgabe zufällig ausgewählter Einheiten in jeder Trainingsphase auf Null gesetzt wird. Dies führt zu einem zufällig unterschiedlichen Menge aktiver Neuralen Einheiten in jeder Trainingsphase, was das Netzwerk dazu anregt, weniger empfindlich auf die Gewichte bestimmter Neuralen Einheiten zu reagieren und so zu einer höheren Generalisierungsfähigkeit führt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Output layer&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Output Layer hat so viele Einheiten wie die Anzahl der Klassen in der Klassifizierungsaufgabe. Bei Klassifizierungsaufgaben mit mehreren Klassen besteht sie nur aus einer Softmax Funktion, die die Ausgabe der vorherigen Ebene in Wahrscheinlichkeiten der einzelnen Klassen umwandelt. Das Ergebnis der Klassifizierungsaufgabe, d. h. die vorhergesagte Klasse, ist dann derjenige mit der höchsten Wahrscheinlichkeit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;convolution-in-der-praxis&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Convolution in der Praxis ===&lt;br /&gt;
&lt;br /&gt;
Normalerweise wendet ein CNN viele Convolution an, um mehr Features extrahieren zu können. Um die Effizienz des Trainings zu erhalten, wird dieses als Parallelrechnung (parallel computation), z.B. durch Ausnützung der Parallelrechner-Fähigkeiten einer Grafikkarte implementiert.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Convolution on grid of vectors&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bisher wurde das Eingabebild (input image) als Raster realer Werte behandelt. In der Praxis handelt es sich bei der Eingabe eines CNN jedoch eher um ein Gitter von Vektoren (grid of vectors). Beispielsweise wird jedes Pixel eines Farbbildes durch ein Vektor der Dimension 3 beschrieben, die die Intensitäten von Rot, Grün und Blau beschreiben.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Zero Padding&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Darstellung der Convolution durch Verschieben des Kernelfensters zeigt sofort, dass die Convolution mit der Kernelbreite (kernel width) &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt; dazu führt, dass die Ausgabebreite(output width) mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(k-1)&amp;lt;/math&amp;gt; schrumpft. Dies kann vermieden werden, indem vor und nach jeder Eingabezeile einige Nullen hinzugefügt werden. Dies wird als Zero Padding (Nullauffüllung) bezeichnet. Zero Padding ermöglicht die unabhängige Steuerung der Ausgabegröße und Kernelbreite. Hier betrachten wir drei Sonderfälle der Zero Padding. Sie werden in der MATLAB-Terminologie als&lt;br /&gt;
&lt;br /&gt;
* gültige Convolution (valid convolution),&lt;br /&gt;
* gleiche Convolution (same convolution) und&lt;br /&gt;
* vollständige Convolution (full convolution)&lt;br /&gt;
&lt;br /&gt;
bezeichnet.&lt;br /&gt;
&lt;br /&gt;
Bei einer gültigen Convolution gibt es keine Zero Padding. Es sind nur die Positionen des Kernelfensters erlaubt, an denen es vollständig im Bild enthalten ist. Somit schrumpft die Ausgabebreite bei Anwenden von jedem Convolution Layer, was die Anzahl der anwendbaren Convolution Layer begrenzt. Bei gleicher Convolution werden der Eingabe so viele Nullen hinzugefügt, womit die Ausgabe die gleiche Breite wie die Breite der Eingabe kommt. Dies bedeutet, dass zu jeder Zeile der Eingabe genau &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(k-1)&amp;lt;/math&amp;gt; Nullen hinzugefügt werden. Normalerweise werden diese Nullen vor dem linken und nach dem rechten Rand des Eingabegitters geteilt, was bedeutet, dass die Pixel am Rand des Eingabegitters Einfluss auf weniger Ausgabepixel haben als diejenigen, die sich innerhalb des Eingabegitters befinden. Die Vermeidung dieses Unterschieds motiviert die vollständige Convolution, bei der der Eingabe so viele Nullen hinzugefügt werden, dass ausreicht, um auch die Pixel am Rand des Eingabegitters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;k&amp;lt;/math&amp;gt;-mal zu besuchen. Dies wird erreicht, indem &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(k-1)&amp;lt;/math&amp;gt; Nullen sowohl vor dem linken als auch nach dem rechten Rand des Eingabegitters hinzugefügt werden. Dies führt jedoch dazu, dass die Ausgabe breiter wird, d. h. die Ausgabegröße wird um &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(k-1)&amp;lt;/math&amp;gt; größer als die Eingabegröße. Die verschiedenen Sonderfälle des Zero Padding sind in Abbildung [[#fig:CNN_9.13|40]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.13&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_9.13.jpg|460px|thumb|center|Abbildung 40: Zero Padding für gültige (Oberes) und gleiche (Unteres) Convolution (Quelle: [Goodfellow et al.(2016)]).]] &amp;lt;span id=&amp;quot;fig:CNN_9.13&amp;quot; label=&amp;quot;fig:CNN_9.13&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;cnn-beispielarchitekturen-für-die-bildklassifizierung&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== CNN Beispielarchitekturen für die Bildklassifizierung ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Eine einfache Musterarchitektur&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eine einfache Beispielarchitektur für die Bildklassifizierung ist in Abbildung [[#fig:CNN_9.11|41]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:CNN_9.11&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:CNN_9.11.jpg|460px|thumb|center|Abbildung 41: Beispielarchitektur für die Bildklassifizierung 256 x 256 x 3 (Quelle: [Goodfellow et al.(2016)]).]] &amp;lt;span id=&amp;quot;fig:CNN_9.11&amp;quot; label=&amp;quot;fig:CNN_9.11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In der ersten Convolution Stage wird 16 parallele Convolution angewendet, um die Extraktion komplexerer lokaler Features und/oder das Erlernen von Invarianzen zu ermöglichen. Diese Beispielarchitektur zeigt die Positionierung der typische Layers in einer CNN-Architektur.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Einige bekannte CNN-Architekturen&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nachstehed sind einige bekannte CNN-Architekturen mit Links zu ihren Beschreibungen aufgeführt.&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/LeNet LeNet-5]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/AlexNet AlexNet]&lt;br /&gt;
* [https://www.geeksforgeeks.org/vgg-16-cnn-model/ VGG-16]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Inceptionv3 Inception-v3]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Residual_neural_network ResNet-50]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;subsec:RNN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Recurrent Neural Network ==&lt;br /&gt;
&lt;br /&gt;
Feedforward Neural Network werden durch gleichzeitige Eingabe (Input) gespeist. Im Gegensatz dazu sind Recurrent Neural Networks - RNN (rekurrentes neuronales Netzwerk) in der Lage, sequentielle Eingaben zu verarbeiten. Es eignet sich für Aufgaben, bei denen es um Eingaben mit sequentiellem Charakter geht, wie z.B. Text, gesprochene Sprache. Die sequentielle Natur der Eingabe spiegelt sich oft in ihrer zeitlichen Natur wider.&lt;br /&gt;
&lt;br /&gt;
Ein Recurrent Neural Network ist ein neuronales Netzwerk, dessen Netzwerkarchitektur einen Zyklus aufweist, d. h. der Wert einer Unit in einer Layer des Netzwerks hängt von ihrer eigenen vorherigen Ausgabe als Eingabe ab. Diese Abhängigkeit ermöglicht, dass die Ausgabe des Recurrent Neural Network aufgrund seiner wiederkehrenden Verbindungen von Hunderten (theoretisch unendlich vielen) vorherigen Input Units abhängt. Diese langfristige Abhängigkeit von der Zeit ist das Novum des RNN, das neue Möglichkeiten für das Recurrent Neural Network eröffnet, beispielsweise wenn es zur Sprachmodellierung verwendet wird.&lt;br /&gt;
&lt;br /&gt;
Der Zyklus in der Netzwerkarchitektur eines Recurrent Neural Network macht es leistungsstark, erschwert jedoch die Schlussfolgerung seiner Ausgabe aus seinen Eingaben und macht auch das Training des Netzwerks komplizierter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;einfaches-recurrent-neural-network&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Einfaches Recurrent Neural Network ===&lt;br /&gt;
&lt;br /&gt;
Wir wollen uns nur mit einer eingeschränkten Unterklasse der allgemeinen Klasse Recurrent Neural Network befassen, den sogenannten Elman Networks (Elman-Netzwerken) [Elman(1990)] oder einfachen Recurrent Neural Network. Diese dient auch als Basis für weitere Architekturen von Recurrent Neural Network, wie z.B. das LSTM (siehe Unterabschnitt [[#subsubsec:LSTM|4.4.4]]). Von nun an werden wir dieses einfache Recurrent Neural Network als Recurrent Neural Network oder RNN bezeichnen.&lt;br /&gt;
&lt;br /&gt;
Wir werden den Index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; verwenden, um die Zeit des gegebenen Vektors darzustellen, wie z.B. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_t&amp;lt;/math&amp;gt; repräsentiert den Eingabevektor zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_t&amp;lt;/math&amp;gt; repräsentiert den Ausgabevektor der einzigen Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;. Die Architektur des RNN ist in Abbildung [[#fig:RNN_9.1|42]] dargestellt ([Elman(1990)]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.1&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.1.jpg|460px|thumb|center|Abbildung 42: Die Architektur des einfachen Recurrent Neural Network (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.1&amp;quot; label=&amp;quot;fig:RNN_9.1&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wie in Abb. 9.1 zu sehen ist, liegt das Wesentliche des RNN in der wiederkehrenden Verknüpfung vom Ausgang der Hidden Layer mit dem Eingang der Hidden Layer, der in der gestrichelten Linie dargestellt ist. Die Ausgabe der Hidden Layer zum vorherigen Zeitpunkt realisiert einen Speicher und kann als Kontext angesehen werden, der Informationen über die Verarbeitung früherer Eingaben kodiert. Noch wichtiger ist, dass im RNN keine Längenbeschränkung für diesen Kontext auferlegt wird. Im Prinzip kann dieser Kontext Informationen bis zum Anfang der Eingabesequenz (input sequence) erfassen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Vorwärtsinferenz (Forward Inference)&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Der Ausgabewert der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t-1&amp;lt;/math&amp;gt; wird bei der Berechnung des Ausgabewerts der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; einbezieht, indem ein neuer Satz von Gewichten darauf angewendet wird, die durch die Matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; dargestellt werden. Somit kann die zeitabhängige Berechnung des RNN wie folgt angegeben werden:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp; {\bf h}_t = f_h({\bf U}{\bf h}_{t-1} + {\bf W}{\bf x}_{t})\\&lt;br /&gt;
&amp;amp; {\bf y}_t = {\bf F}_o({\bf V}{\bf h}_{t}). &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die Aktivierungsfunktion der Output Layer &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf F}_o({\bf z}_{t})&amp;lt;/math&amp;gt; ist normalerweise eine Softmax Funktion, also eine Vektorwertige Funktion. Das Hinzufügen der Zeitabhängigkeit zur Beschreibung von RNN scheint dieses Netzwerk komplexer zu machen, aber tatsächlich kann seine Berechnung durch die Einführung des Vektors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t-1}&amp;lt;/math&amp;gt; auf eine Berechnung eines entprechenden Feedforward Network zurückgeführt werden. Dies ist in Abbildung [[#fig:RNN_9.2|43]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.2&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.2.jpg|460px|thumb|center|Abbildung 43: Die Einfaches Recurrent Neural Network, dargestellt als entsprechendes Feedforward Network (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.2&amp;quot; label=&amp;quot;fig:RNN_9.2&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Der sequentielle Charakter des RNN kann durch zeitliches Ausrollen hervorgehoben werden. Dies ist in Abbildung [[#fig:RNN_9.4|44]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.4&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.4.jpg|460px|thumb|center|Abbildung 44: Die Einfaches Recurrent Neural Network, dargestellt im zeitlichen Ablauf (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.4&amp;quot; label=&amp;quot;fig:RNN_9.4&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathrm{\ \ \ \ }&amp;lt;/math&amp;gt; Training&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
RNN zu trainieren bedeutet, die Parameter der Gewichtsmatrizen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf W}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf U}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf V}&amp;lt;/math&amp;gt; zu lernen. Aufgrund der wiederkehrenden Struktur des Netzwerks sind vor der Gestaltung des Trainings folgende Überlegungen notwendig.&lt;br /&gt;
&lt;br /&gt;
* Die Berechnung des Loss zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; erfordert die Ausgabe der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t-1&amp;lt;/math&amp;gt;.&lt;br /&gt;
* Die Ausgabe der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; beeinflusst nicht nur die Ausgabe des Netzwerks zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, sondern auch die Ausgabe der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t+1&amp;lt;/math&amp;gt;.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Leftrightarrow&amp;lt;/math&amp;gt; Die Berechnung des Fehlers am Ausgang der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; erfordert die Kenntnis seiner Auswirkung auf &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}_{t}&amp;lt;/math&amp;gt; und alle &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}_{t+i}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t+i}&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i \geq 1&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Daraus folgt, dass das Training von RNN das Ausrollen des Recurrent Neural Network in ein Feedforward Network erfordert und das Training dann auf diesem Feedforward Network auf übliche Weise durchgeführt werden kann, einschließlich der folgenden zwei Durchgänge:&lt;br /&gt;
&lt;br /&gt;
* Vorwärtsinferenz, Berechnung von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf y}_{t}&amp;lt;/math&amp;gt; und Speichern von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt; für die Verwendung des nächsten Zeitschritts &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t \geq 1&amp;lt;/math&amp;gt; sowie die Akkumulation des Loss bei jedem Zeitschritt.&lt;br /&gt;
* Rückwärtsdurchlauf (backward pass), um den Fehler der Ausgabe der Hidden Layer für jeden rekursiven Rückschritt zu berechnen und zu speichern sowie den Gradient zu berechnen.&lt;br /&gt;
&lt;br /&gt;
Dieser Ansatz zum Training von RNN wird als Backpropagation Through Time [Werbos(1974)] bezeichnet.&lt;br /&gt;
&lt;br /&gt;
Bei Anwendungen mit längeren Eingabesequenzen, wie z.B. Streaming, Spracherkennung, muss das Ausrollen auf Segmente mit fester Länge beschränkt werden, da das Ausrollen der gesamten Eingabesequenz praktisch nicht möglich ist.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;stacked-rnn&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Stacked RNN ===&lt;br /&gt;
&lt;br /&gt;
Stacked RNN (gestapeltes RNN) ist eine Erweiterung von RNN, bei der die gesamte Ausgabesequenz eines RNN als Eingabesequenz für ein nächstes RNN verwendet wird. Die Architektur des Stacked RNN ist in Abbildung [[#fig:RNN_9.10|45]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.10&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.10.jpg|460px|thumb|center|Abbildung 45: Architektur des Stacked RNN (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.10&amp;quot; label=&amp;quot;fig:RNN_9.10&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Stacked RNNs haben im Allgemeinen höhere Fähigkeiten als ein RNN. Dies liegt daran, dass allgemein davon ausgegangen wird, dass jede Layer eine andere Abstraktionsebene einführt. Allerdings steigt der Zeit- und Ressourcenbedarf des Trainings mit der Anzahl der Layer schnell an. Die optimale Anzahl der Layer hängt von den Anforderungen der Anwendung ab.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;bidirektionales-rnn&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Bidirektionales RNN ===&lt;br /&gt;
&lt;br /&gt;
Die Idee des bidirektionalen RNN [SchusterPaliwal(1997)] besteht darin, nicht nur die Kontextinformationen aus dem linken Teil der Folge von Eingabevektoren (linker Kontext), sondern auch aus dem rechten Teil davon zu verwenden. In Anwendungen, in denen die Sequenz keine Zeit darstellt und die gesamte Eingabesequenz verfügbar ist, ist diese Architektur sinnvoll. Es stellt sicher, dass Kontokontextinformationen nicht nur von links, sondern auch von rechts genutzt werden, was z. B. die Leistung der Klassifizierungsaufgabe verbessert.&lt;br /&gt;
&lt;br /&gt;
Im RNN repräsentiert die Ausgabe der Hidden Layer zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; die Kontextinformationen aus dem linken Teil der Folge von Eingabevektoren. Dies kann als Vorwärts-RNN angesehen werden, da die Hidden Layer die Informationen über die Eingabevektoren von links nach rechts weitergibt. Ein ähnlicher Rückwärts-RNN kann eingerichtet werden, dessen Hidden Layer die Informationen über die Eingabevektoren von rechts nach links weitergibt. Somit können die Ausgabevektoren der Vorwärts- und Rückwärts-RNNs, als Hidden Layers, zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}^f&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}^b&amp;lt;/math&amp;gt; als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
&amp;amp; {\bf h}_{t}^f = RNN_{forward}({\bf x}_{1}, \ldots, {\bf x}_{t})\\&lt;br /&gt;
&amp;amp; {\bf h}_{t}^b = RNN_{backward}({\bf x}_{t}, \ldots, {\bf x}_{n}) &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt; beschrieben werden, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n&amp;lt;/math&amp;gt; ist die Anzahl der Eingabevektoren in der Eingabesequenz. Die Parametergewichte des Rückwärts-RNN können durch das Training eines RNN auf einer umgekehrten Eingabesequenz erlernt werden.&lt;br /&gt;
&lt;br /&gt;
Dann werden die gesamten Zustands- oder Kontextinformationen zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; zusammengestellt, indem sowohl die linken als auch die rechten Kontextinformationen kombiniert werden. Dies geschieht durch die Kombination der Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}^f&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}^b&amp;lt;/math&amp;gt;, die die linken und die rechten Kontextinformationen darstellen. Mögliche Kombinationsvarianten sind Verkettung (concatenation), Multiplikation oder elementweise Addition. Beispielsweise kann durch Anwenden der Verkettung der Vektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt;, der die gesamten Kontextinformationen darstellt, als&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;{\bf h}_{t} = [{\bf h}_{t}^f {\bf h}_{t}^b],&amp;lt;/math&amp;gt; angegeben werden, wobei &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;[{\bf a} {\bf b}]&amp;lt;/math&amp;gt; für die Verkettung der Vektoren &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf a}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf b}&amp;lt;/math&amp;gt; steht. Ein solches bidirektionales RNN mit Verkettung ist in Abbildung [[#fig:RNN_9.11|46]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.11&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.11.jpg|460px|thumb|center|Abbildung 46: Bidirektionales RNN mit separat trainierten Modellen in Vorwärts- und Rückwärtsrichtung (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.11&amp;quot; label=&amp;quot;fig:RNN_9.11&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;subsubsec:LSTM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Das LSTM ===&lt;br /&gt;
&lt;br /&gt;
Eine Einschränkung von RNN besteht darin, dass es für Aufgaben, bei denen Informationen berücksichtigt werden müssen, die weit vom aktuellen Index &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt; entfernt sind, nicht effektiv ist. Der Grund dafür ist, dass die in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt; kodierten Informationen eher lokal sind und somit den Einfluss näherer Teile der Eingabesequenz widerspiegeln.&lt;br /&gt;
&lt;br /&gt;
Um dieses Problem zu lösen, wurden kompliziertere RNN-Architekturen entworfen, die explizit diejenige Informationsteile steuern, die vergessen beziehungsweise für die zukünftige Verwendung gespeichert werden sollen, und diese Steuerung dynamisch über die Zeit durchführen. Eine solche RNN-Architektur ist das neuronale Netzwerk Long Short-Term Memory (LSTM)&amp;lt;br /&amp;gt;&lt;br /&gt;
Das LSTM wird als Hidden Unit realisiert. Es führt zu jedem Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, einen Kontextvektor, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t}&amp;lt;/math&amp;gt;, ein. Der Kontextvektor wird zur Maskierung bei der Berechnung der tatsächlichen Ausgabe der Hidden Unit zum Zeitpunkt &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;t&amp;lt;/math&amp;gt;, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt; verwendet. Andererseits wird der Kontextvektor bei jedem Zeitschritt aktualisiert, d. h. &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t}&amp;lt;/math&amp;gt; wird aus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t-1}&amp;lt;/math&amp;gt; berechnet. Während dieses Updates wird&lt;br /&gt;
&lt;br /&gt;
* ein Teil des Kontextvektors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t-1}&amp;lt;/math&amp;gt; durch Maskierung mit dem Forget Gate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf f}_{t}&amp;lt;/math&amp;gt; gelöscht (welches &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf k}_{ t}&amp;lt;/math&amp;gt; resultiert) und&lt;br /&gt;
* ein Teil der eigentlichen Information &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}_{t}&amp;lt;/math&amp;gt;, die aus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t-1}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{t}&amp;lt;/math&amp;gt; wie üblich extrahiert, wird durch Maskierung mit dem Add Gate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf i}_{t}&amp;lt;/math&amp;gt; bewahrt (welches &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf j}_{t}&amp;lt;/math&amp;gt; resultiert) und&lt;br /&gt;
* die Summe von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf k}_{t}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf j}_{t}&amp;lt;/math&amp;gt; gebildet um den aktualisierten Kontextvektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t}&amp;lt;/math&amp;gt; anzugeben.&lt;br /&gt;
&lt;br /&gt;
Die elementweise Multiplikation (auch als Hadamard-Produkt von Vektoren bezeichnet) wird mit &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\odot&amp;lt;/math&amp;gt; bezeichnet, und die Sigmoid Aktivierungsfunktionen werden zur Realisierung der Funktionalität der Maskierung verwendet. Das Sigmoid wird aufgrund seiner Eigenschaft ausgewählt, indem seine Eingabe entweder in Richtung &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;0&amp;lt;/math&amp;gt; oder &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;1&amp;lt;/math&amp;gt; zu werfen. Genauer gesagt werden die oben genannten Vektoren, wie folgt, berechnet.&lt;br /&gt;
&lt;br /&gt;
# Löschen eines Teils von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t-1}&amp;lt;/math&amp;gt; durch Maskieren mit dem Forget Gate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf f}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf k}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp; {\bf f}_{t} = \sigma({\bf U}_{f}{\bf h}_{t-1} + {\bf W}_{f}{\bf x}_{t}) \\&lt;br /&gt;
    &amp;amp; {\bf k}_{t} = {\bf c}_{t-1} \odot {\bf f}_{t}. &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Extrahieren der tatsächlichen Informationen &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf g}_{t}&amp;lt;/math&amp;gt; aus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t-1}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{t}&amp;lt;/math&amp;gt; sowie Bewahren eines Teils davon durch Maskieren mit das Add Gate &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf i}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf j}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp; {\bf g}_{t} = tanh(({\bf U}_{g}{\bf h}_{t-1} + {\bf W}_{g}{\bf x}_{t})&lt;br /&gt;
    &amp;amp; {\bf i}_{t} = \sigma({\bf U}_{i}{\bf h}_{t-1} + {\bf W}_{i}{\bf x}_{t}) \\&lt;br /&gt;
    &amp;amp; {\bf j}_{t} = {\bf g}_{t} \odot {\bf i}_{t}. &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Zusammenstellen des aktualisierten Kontextvektors durch Summieren von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf k}_{t}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf j}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp; {\bf c}_{t} = {\bf k}_{t} + {\bf j}_{t}. &lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
# Berechnen von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf o}_{t}&amp;lt;/math&amp;gt; auf übliche Weise aus &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t-1}&amp;lt;/math&amp;gt; und &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf x}_{t}&amp;lt;/math&amp;gt; sowie erstellen den Ausgabevektor der Hidden Unit durch Maskieren von &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf o}_{t}&amp;lt;/math&amp;gt; mit dem tatsächlichen Kontextvektor &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf c}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Rightarrow&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;{\bf h}_{t}&amp;lt;/math&amp;gt; &amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;\begin{aligned}&lt;br /&gt;
    &amp;amp; {\bf o}_{t} = \sigma({\bf U}_{o}{\bf h}_{t-1} + {\bf W}_{o}{\bf x}_{t}) \\&lt;br /&gt;
    &amp;amp; {\bf h}_{t} = {\bf o}_{t} \odot tanh({\bf c}_{t}).&lt;br /&gt;
    &lt;br /&gt;
\end{aligned}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Die gesamte Berechnung der neuronalen LSTM-Einheit ist in Abbildung [[#fig:RNN_9.13|47]] dargestellt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.13&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.13.jpg|460px|thumb|center|Abbildung 47: Die Berechnungsarchitektur einer neuronalen LSTM-Einheit (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.13&amp;quot; label=&amp;quot;fig:RNN_9.13&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Der Vergleich der Eingabe- und Ausgabeschnittstellen der neuronalen Einheiten FNN, RNN und LSTM ist in Abbildung [[#fig:RNN_9.14|48]] zu sehen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;fig:RNN_9.14&amp;quot; class=&amp;quot;figure&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Datei:RNN_9.14.jpg|460px|thumb|center|Abbildung 48: Neuronale Einheiten von (a) FNN, (b) RNN und (c) LSTM (Quelle: [JurafskyMartin(2023)]).]] &amp;lt;span id=&amp;quot;fig:RNN_9.14&amp;quot; label=&amp;quot;fig:RNN_9.14&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>SAFFER Zsolt</name></author>
	</entry>
</feed>