Answers.Body: <p>The first column is added in order to be able to align the sequences. They might be gaps if the alignment ends up beginning in different positions than the first. Without the first empty row and column it wouldn't be possible to have gaps at the beginning of the alignment</p>
  
  <p>The <a href="https://en.wikipedia.org/wiki/Dynamic_programming" rel="nofollow noreferrer">dynamic programming</a> is useful because you need first to calculate the score for each position, and then once you have the score, you can calculate the optimum path. So you solve your problem by first calculating what would happen if (there was a gap, there was a mismatch...) and then you find the optimum alignment. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-06T17:30:02.670Z
Answers.Text: Dynamic programming isn't strictly needed, it's just convenient to use recursion to handle the rows (depending on the implementation, you can also save memory by not storing the full matrix then).
Answers.UserDisplayName: Devon Ryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-06T11:48:35.450Z
Answers.LastActivityDate: 2018-12-07T14:49:49.640Z
Answers.LastEditDate: 2018-12-07T14:49:49.640Z
Answers.UserDisplayName: llrs
Body: <p>I would like to ask why when we initialize 0 as the starting point, there are 3 gray boxes that are not used as shown (highlighted in the red box) in the pic?
  <a href="https://i.sstatic.net/ZyvEM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZyvEM.png" alt="pic of matrix"></a>
   Are these boxes to show that they are gaps or just to align them properly?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-06T02:20:38.610Z
Comments.Text: I would also like to ask how dynamic programming plays a part in filling up the rows and columns in the matrix. (I'm new to bioinformatics)
Comments.UserDisplayName: Heeh wei cheng
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-06T11:37:05.247Z
Comments.Text: Welcome to the site Heeh. You can [edit] your question to add things to the question like more information. Could you clarify what do you mean by "how dynamic programming plays a part"? Do you want to know what is dynamic programming? Or perhaps why it is needed for this algorithm?
Comments.UserDisplayName: llrs
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-07T01:58:50.567Z
Comments.Text: Hi I would like to know both about dynamic programming and why it is needed for this algorithm. I searched the meaning of dynamic programming but I do not understand the meaning behind recursive.
Comments.UserDisplayName: Heeh wei cheng
Tags: <phylogenetics>
Title: Understanding the initialization of the Needleman-Wunsch algorithm
ThreadText: # Understanding the initialization of the Needleman-Wunsch algorithm
  
  (Asked by: username_0 on 2018-12-06)
  
  I would like to ask why when we initialize 0 as the starting point, there are 3 gray boxes that are not used as shown (highlighted in the red box) in the pic?
  [![pic of matrix](https://i.sstatic.net/ZyvEM.png)](https://i.sstatic.net/ZyvEM.png)
  Are these boxes to show that they are gaps or just to align them properly?
  
  **Tags:** phylogenetics
  
  > **Comments:**
  > **username_0**: I would also like to ask how dynamic programming plays a part in filling up the rows and columns in the matrix. (I'm new to bioinformatics)  
  > **username_1**: Welcome to the site username_0. You can [edit] your question to add things to the question like more information. Could you clarify what do you mean by "how dynamic programming plays a part"? Do you want to know what is dynamic programming? Or perhaps why it is needed for this algorithm?  
  > **username_0**: Hi I would like to know both about dynamic programming and why it is needed for this algorithm. I searched the meaning of dynamic programming but I do not understand the meaning behind recursive.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-12-06. Score: 7 | Accepted answer
  
  The first column is added in order to be able to align the sequences. They might be gaps if the alignment ends up beginning in different positions than the first. Without the first empty row and column it wouldn't be possible to have gaps at the beginning of the alignment
  
  The [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) is useful because you need first to calculate the score for each position, and then once you have the score, you can calculate the optimum path. So you solve your problem by first calculating what would happen if (there was a gap, there was a mismatch...) and then you find the optimum alignment.
  
  > **Comments:**
  > **username_2**: Dynamic programming isn't strictly needed, it's just convenient to use recursion to handle the rows (depending on the implementation, you can also save memory by not storing the full matrix then).  
  
  ---
  
  