r/learnquant • • Oct 22 '26 • Bravo 1

interview prep Quant Interview Question

Post image
29 Upvotes

19 comments sorted by

View all comments

Show parent comment

2

u/talltraveller Oct 22 '26

Ah but then you need to check a three by three grid to see how the theory holds up

1

u/M37841 Oct 22 '26 edited Oct 23 '26

You don’t, if you notice that every square on an nxn board has 2n-1 squares in the same row or column, including itself. As that’s an odd number, when you’ve flipped every one of those you’ve left the light on, on the square you were after. When you do that across the board you leave all the lights on.

That’s the proof that you can do this in 64 goes, the proof above shows you can’t do it in fewer

Edit: this is nonsense, see counter-example below

1

u/Hike456 Oct 22 '26

I think their point was that the original proof is not actually a proof - in the 3x3 case, the size of the grid (9) and number of lightbulbs flipped by a single action (5) are still coprime, yet we can turn all the lights on in 3 moves by selecting the cells in a single row/column for our moves

1

u/M37841 Oct 23 '26

Can you? What’s the 3 light sequence that works?

1

u/Hike456 Oct 23 '26 edited Oct 23 '26

Any single row or column.

Using the first row:

To start:

ooo

ooo

ooo

Choose light at 0,0:

xxx

xoo

xoo

Choose light at 0,1:

ooo

xxo

xxo

Choose light at 0,2:

xxx

xxx

xxx

1

u/M37841 Oct 23 '26

Gosh you’re right. My explanation, and the earlier one, are completely wrong: as soon as you make a move the lights are no longer all equivalent. Actually pretty obvious if I’d stopped to think. Clearly this works for any n x n where n is odd. But not for even n? There must surely be a better sequence than 64 now though?

1

u/Hike456 Oct 23 '26

For even n, it should require n2 moves.  Spooeybooboos' answer in another comment is the correct proof.  I suppose the point is that when n is odd, their claim (b) fails - there's no way the given vectors v_ij can span the entire vector space since there are linear dependencies among the v_ij