A jar had the same number of green marbles and red marbles.

After a child took out 10 marbles, the remaining green marbles were 3 times the remaining red marbles.

How many red marbles were initially in the jar?
M = 3(M-10)

Solve for M

(This assumes they took out all red which your solution seems to assume.)

If they remove a mix of colors there are other solutions like 7 (remove 6 red and 4 green)
There are actually multiple solutions to this based on what you've told us

Since we don't know the combination of marbles taken out of the jar, we can set up a few scenarios

1) take out 0 green marbles and take out 10 red marbles

2) take out 1 green marble and take out 9 red marbles

...

10) take out 10 green marbles and take out 0 red marbles

Now, we know that the remaining green marbles is greater than the remaining red marbles AND that we started with the same green and red

So the number of red marbles taken out MUST be greater than the number of green marbles taken out, so you can eliminate all scenarios where you take out more green than red

The rest of the scenarios can then be evaluated using the fact that there are 3x as many green marbles as there are red by the end

Your answer seems to assume that you took out 10 red, but removing 4 green and 6 red is also a solution, as is starting with 5 of each color and removing all 10 marbles technically (since 3x0=0)

Edit: actually, now that I've sat down and thought about this, there is actually a viable solution if you take out anywhere from 0 to 5 green marbles
{"ft_lang_label":"__label__en","ft_lang_prob":0.9583117,"math_prob":0.9820425,"size":1129,"snap":"2022-40-2023-06","text_gpt3_token_len":278,"char_repetition_ratio":0.20266667,"word_repetition_ratio":0.00921659,"special_character_ratio":0.23472099,"punctuation_ratio":0.047413792,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.979835,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-31T09:35:15Z\",\"WARC-Record-ID\":\"<urn:uuid:97a4a10d-da19-44b8-b4a9-76d17d4e4217>\",\"Content-Length\":\"46059\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ecbe18e3-4acc-4768-9c18-e01ccfd5c976>\",\"WARC-Concurrent-To\":\"<urn:uuid:deb5e883-9430-414f-958e-75aa5e2858e5>\",\"WARC-IP-Address\":\"163.172.28.146\",\"WARC-Target-URI\":\"https://ohhaskme.com/273742/integer-problem\",\"WARC-Payload-Digest\":\"sha1:IUTD4XALIRX4GST2HW35IBR3GTW4Z7QZ\",\"WARC-Block-Digest\":\"sha1:CR3QBJLIFVKKHNSZ6U4EAYEYBNW56MCP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499857.57_warc_CC-MAIN-20230131091122-20230131121122-00162.warc.gz\"}"}