How come this solution to Tsumego is working?

From the application Tsumego Pro, I found this problem (on Today's daily):

``````\$\$ ------------------
\$\$ . . . X . . X O . |
\$\$ . . . O X . X O . |
\$\$ . . . O O X X O . |
\$\$ . . . . O O O X . |
\$\$ . . . . . . . X . |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

The application suggests the following solution:

``````\$\$ Problem Solved
\$\$ ------------------
\$\$ . . 2 . 4 1 X O . |
\$\$ . . . O X . X O . |
\$\$ . . . O O X X O 3 |
\$\$ . . . . O O O X . |
\$\$ . . . . . . . X . |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

How come this is solved? What should be black next move?

(I'm a beginner, so take anything I say with a grain of salt).

Two things about Tsumegos (which I actually learned on this very site):

1. You're looking for the best possible solution, which is not always "black lives unconditionally". If, like it seems here, black cannot make two eyes, live in seki, or run out, then living in ko is the best solution.
2. You should not make any assumptions what the rest of the board looks like (a tsumego is a local situation, but it's not meant to be understood as "the rest of the board is empty"). In particular, the situation elsewhere on the board might just favor black, in which case black can live.

If black has a good ko threat somewhere, but white does not, then this happens after your second screenshot:

``````\$\$ 1: ko threat, 2: response, 4: (ignored) ko threat
\$\$ ------------------
\$\$ . . O 3 O X X O . |
\$\$ . . . O X . X O 5 |
\$\$ . . . O O X X O X |
\$\$ . . . . O O O X . |
\$\$ . . . . . . . X . |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

After white now takes back the ko, black kills the three white stones and is out, but even more -- as far as I can tell it can actually make two eyes right here (if white 6 elsewhere, then either 8 at 6 instead, leaving the same result at what's described below, or black fills the ko with 9 and makes a second eye that way):

``````\$\$ ------------------
\$\$ . . O X 6 X X O 7 |
\$\$ . . . O X . X O X |
\$\$ . . . O O X X O X |
\$\$ . . . . O O O X . |
\$\$ . . . . . . . X . |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

If white now plays the vital point at 8, black plays 9, and a and b are miai to make the false eye true:

``````\$\$ ------------------
\$\$ . . O . O X X a X |
\$\$ . . . O X . X 8 X |
\$\$ . . . O O X X b X |
\$\$ . . . . O O O X . |
\$\$ . . . . . . . X 9 |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

If white plays 8 anywhere else, black takes that point instead, and has two eyes (even if white plays a and b in 8 and 10, black takes with c, after which a would make the false eye true, and b would create a third eye, so black lives in either case):

``````\$\$ 8: anywhere
\$\$ ------------------
\$\$ . . O . O X X . X |
\$\$ . . . O X . X 9 X |
\$\$ . . . O O X X . X |
\$\$ . . . . O O O X a |
\$\$ . . . . . . . X b |
\$\$ . . . . . . X . c |
\$\$ . . . . . . . . . |
``````

One thing I didn't address was the possibility for white to play 4 locally like this:

``````\$\$ ------------------
\$\$ . . O X 6 X X O . |
\$\$ . . . O X . X O . |
\$\$ . . . O O X X O X |
\$\$ . . . . O O O X 4 |
\$\$ . . . . . . . X 5 |
\$\$ . . . . . . X . . |
\$\$ . . . . . . . . . |
``````

so maybe one black ko threat isn't enough.

Anyway, given enough ko threats, black can live. That's not as good as living unconditionally, but if the latter is not possible, a ko is the best result.