Direction of arrow

direction = pos * \theta_2 / \theta_1
I didn’t understand direction equation above

Hey @Atef_Yasser,
The equation is pretty simple to derive by yourself, that way, you will understand it even better. First, you can write the equation of the grey line as mentioned in the section “Plot the model alongside the data” in UGL 03. Comparing the derived equation;

neg = \frac{(-\theta_0 - \theta_1 * pos)}{\theta_2}

to the standard equation of a line in linear algebra y = mx + c, we will get;

m = \frac{-\theta_1}{\theta_2}

From linear algebra, we know that the product of slopes of 2 perpendicular lines is -1, i.e., say m_1 is the slope of the grey line and m_2 is the slope of the green line, then m_1 * m_2 = -1. Therefore,

m_2 = \frac{-1}{m_1} = \frac{\theta_2}{\theta_1}

which is the slope of the equation that you mentioned. And since, we are only interested in the slope of the green line, hence the above equation. In this UGL, we are using this to find out the direction for the green and the red lines, so that we can plot them in the graph. Let us know if this helps.



OOh, thanks my friend :heart: