We will trace the algorithm epoch by epoch until no more updates are made.
Initial State:
- $w_0=\left[\begin{array}{l}0 \\ 0\end{array}\right]$
Epoch 1
1. Point 1: $x_1=\left[\begin{array}{l}2 \\ 2\end{array}\right], y_1=+1$
- Calculate activation: $w_0^T x_1=\left[\begin{array}{ll}0 & 0\end{array}\right]\left[\begin{array}{l}2 \\ 2\end{array}\right]=0$.
- Predict class: Since $0 \geq 0$, the predicted class $\dot{y}_1$ is +1 .
- Check for error: $\hat{y}_1=y_1$. The point is correctly classified.
- Result: No update. w remains $\left[\begin{array}{l}0 \\ 0\end{array}\right]$.
2. Point 2: $x_2=\left[\begin{array}{c}2 \\ -2\end{array}\right], y_2=+1$
- Calculate activation: $w^T x_2=\left|\begin{array}{ll}0 & 0\end{array}\right|\left[\begin{array}{c}2 \\ 2\end{array}\right]=0$.
- Predict class: Since $0 \geq 0$, the predicted class $\hat{y}_2$ is +1.
- Check for error: $\hat{y}_2=y_2$. The point is correctly classified.
- Result: No update. $w$ remains $\left[\begin{array}{l}0 \\ 0\end{array}\right]$.
3. Point 3: $x_3=\left[\begin{array}{c}2 \\ 1\end{array}\right], y_3=-1$
- Calculate activation: $w^T x_3=\left|\begin{array}{ll}0 & 0\end{array}\right|\left[\begin{array}{c}2 \\ 1\end{array}\right]=0$.
- Predict class: Since $0 \geq 0$, the predicted class $\hat{y}_3$ is +1.
- Check for error: $\hat{y}_3 \neq y_3$ (predicted +1 , actual -1 ). The point is misclassified.
- Result: Update weights.
$$
w_{\text {new }}=w_{\text {old }}+y_3 \cdot x_3=\left[\begin{array}{l}
0 \\
0
\end{array}\right]+(-1)\left[\begin{array}{c}
-2 \\
1
\end{array}\right]=\left[\begin{array}{c}
2 \\
-1
\end{array}\right] .
$$
End of Epoch 1: An update occurred. The new weight vector is $w=\left[\begin{array}{c}2 \\ -1\end{array}\right]$. We proceed to the next epoch.
Epoch 2
1. Point 1: $x_1=\left[\begin{array}{l}2 \\ 2\end{array}\right], y_1=+1$
- Calculate activation: $w^T x_1=\left[\begin{array}{ll}2 & -1\end{array}\right]\left[\begin{array}{l}2 \\ 2\end{array}\right]=(2)(2)+(-1)(2)=2$.
- Predict class: Since $2 \geq 0, \hat{y}_1=+1$.
- Check for error: $\hat{y}_1=y_1$. Correctly classified. No update.
2. Point 2: $x_2=\left[\begin{array}{c}2 \\ -2\end{array}\right], y_2=+1$
- Calculate activation: $w^T x_2=\left[\begin{array}{ll}2 & 1\end{array}\right]\left[\begin{array}{c}2 \\ -2\end{array}\right]=(2)(2)+(-1)(-2)=6$.
- Predict class: Since $6 \geq 0, \hat{y}_2=+1$.
- Check for error: $\hat{y}_2=y_2$. Correctly classified. No update.
3. Point 3: $x_3=\left[\begin{array}{c}-2 \\ 1\end{array}\right], y_3=-1$
- Calculate activation: $w^T x_3=\left[\begin{array}{ll}2 & -1\end{array}\right]\left[\begin{array}{c}-2 \\ 1\end{array}\right]=(2)(-2)+(-1)(1)=-5$.
- Predict class: Since $5<0, \hat{y}_3=-1$.
- Check for error: $\hat{y}_3=y_3$. Correctly classified. No update.
End of Epoch 2: No updates were made during this entire epoch. The algorithm has converged.
The algorithm will converge with $w=\left[\begin{array}{c}2 \\ -1\end{array}\right]$