we can suppose that the soldier is at the top-right edge of the grid
firstly, we can easily get an answer of (2n-2)
by making the soldier turn right/ left at each end of the line(always go downwards),the turn right/left at the beginning of a new line,the soldier an go through every line of the grid with (2n-2)turns
now we prove that there can't be less than( 2n-2) turns
we mark each square that the soldier turns into red
then prove: except the first line or the last line the soldier passes,there are no less than two red squares in each line, or else the total turn is more than(2n-2)
if there don't exist a line that has less than two red squares the the total turns is obviously no less than(2n-2)
if there is one,and it has one red square, then it is obviously the last line the soldier goes through(no more turns after the only red square)
if there is one, and it has no red squares, then the only way for the soldier to pass the squares in this special line is vertically go pass one.
note that each vertical pass only passes one square, and it takes at least two turns to turn the direction from a vertical one to a vertical one,so there is more than 2*(n-1)+1 turns(the original direction is horizontal),which is more than (2n-2).
QED.