Title: Simple Kirchoff's Law Problem
Tags: homework-and-exercises;electric-circuits;electric-current;electrical-resistance;batteries
Question: I'm stuck on a fairly simple problem regarding Kirchoff's law, using this diagram:
The question asks:
What is the current through the $10.0$ V battery?
The solution manual says that the answer is $0.583$ Amps, derived from adding the current through the $20.0$ Ohm resistor and the current through the $30.0$ Ohm resistor.
My Question:
According to Kirchoff's laws, the current going into a junction is the same as the current going out. So if my understanding is correct, shouldn't we have:
$$I_{\text{through battery}}=I_{\text{through 30 ohm}}-I_{\text{through 20 ohm}}$$
Instead of addition? Is it because the currents are going in opposite directions?
Thank you all for the help in advance.
Edit: I think that the real misunderstanding I'm having is the direction of the currents. I can't tell which way the current through the $30$ Ohm resistor is going in versus the current through the $20$ Ohm one.

Here is the accepted answer: To solve these problems it is not that important that you correctly assign the correct circulation to the currents - if you get it "wrong" it just means that you will obtain a current with a minus sign. What is important is that you assign a convention for a given loop, and use it consistently.
For the circuit that you give I can assign the currents as shown in the figure:
so that $I_1$ is going clockwise, and $I_2$ is anticlockwise. In the $30 \Omega$ resistor, using this convention, the current is the sum of the two incoming currents.
I can now divide the circuit into three loops. As we only have two unknowns ($I_1$ and $I_2$) we only need to use two of them, but we can use the third as a consistency check.
On the left: $10 = 30 (I_1 + I_2 )$,
on the right: $5 = 20 I_2 + 30 (I_1 + I_2 )$,
and the "outer loop": $10 - 5 = -20 I_2$.
Take any pair of these equations, and you should obtain that $I_1 = 7/12 A$ and $I_2 = -1/4 A$. The minus sign on $I_2$ just means that in fact $I_2$ is circulating in the reverse sense to the way I assumed, and is actually flowing clockwise.
Comment for this answer: Thank you for the great answer.
Comment for this answer: Great answer!
But I disagree with the signs of the voltages
in your equations. I think it should be $-10$ and $-5$
(instead of $10$ and $5$).
Then the resulting currents would come with opposite
signs: $I_2=-\frac{1}{4}$ A and $I_1=\frac{7}{12}$ A.
Comment for this answer: Thanks Thomas, yes you're absolutely right. I've changed them now (hopefully correctly).

Here is another answer: The law is the algebraic sum of the currents going into the node is zero. Current goes into the node from the 10 V battery, The currents in the 30 and 20 Ohm resistors are both going out of the node, hence the sum, not the difference. Note: the current in the 20 Ohm resistor is (10 V - 5 V)/30 .
Edit: I think that the real misunderstanding I'm having is the
direction of the currents. I can't tell which way the current through
the 30 Ohm resistor is going in versus the current through the 20 Ohm
one.
In this case its easy to see by inspection. However, you don't have to know the directions of the currents. Simply assume a direction for the current in each loop (clockwise or counterclockwise) and apply Kirchhoff's voltage law (KVL) to each loop. If a current comes out negative, it simply means it is in the opposite direction to that assumed.
When you apply KVL be careful to account for the contribution of all currents to a voltage drop across a resistor if  more than one current flows through the resistor. For example, if you chose a clockwise current for the left loop and a counter clockwise current for the right loop you have two currents flowing in the 30 Ohm resistor that is common to both loops.
Hope this helps.
Comment for this answer: I don't understand why the currents through the 30 ohm and 20 ohm resistors both go out of the node. I thought that the current in the left loop (inside the circuit) is clockwise, whereas the current in the right loop is going counter-clockwise.
Comment for this answer: Thank you for the great answer.
Comment for this answer: @高田航 See my revised answer to include your edit.

Here is another answer: As you will see from another answer you can use Kirchhoff's laws to solve your problem.
Often the actual direction of the current is not know and so one has to label a current with a direction arrow and a symbol.
In this case since the $10 \,\rm V$ voltage supply is the largest in the circuit it is likely that the current will be flowing into its negative termnal and out of its positive terminal.
However the current through the $5\,\rm V$ supply is not so clear cut and so one can either label the current leaving its positive terminal $I_+$ or leaving the negative terminal $I_{\rm -}$.
Having applied Kirchhoff's law in a consistent manner one would find that $I_+ = -\frac 14 \rm \, A$ ie the current is actually entering the positive terminal or $I_- = +\frac 14 \,\rm A$ ie the current is entering the negative terminal.
So either form of the label gives the same final result.
An insight into what is going in terms of the flow of currents might be advanced by solving the problem via the method of superposition where one considers the effect of each voltage source alone to find the currents which flow under such a condition and then sums the currents to find the actual currents flowing in the circuit.
The top left hand circuit considers the effect of having only the $10\,\rm V$ voltage source in the circuit with the $5\,\rm V$ voltage source shorted out and the top right hand circuit does the same with only the $5\,\rm V$ voltage supply present.
The bottom circuit has voltage supplies present and the actual currents which flow in the circuit.
The $\frac{7}{12}\,\rm A$ flowing out of the $10 \,\rm V$ voltage supply can be thought of as a current of $\frac 56 \,\rm A$ produced by the $10\,\rm V$ voltage supply and flowing out of its positive terminal and a current of $\frac 14 \,\rm A$ produced by the $5\,\rm V$ voltage supply and flowing into its positive terminal.

{'source': 'StackExchangeDataset', 'subset': 'physics.stackexchange.com', 'metadata': {'AnswerCount': 3, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:02/26/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<homework-and-exercises><electric-circuits><electric-current><electrical-resistance><batteries>', 'Title': "Simple Kirchoff's Law Problem", 'ViewCount': 554, 'id': 533226, 'user_AboutMe': None, 'user_AccountId': 10053829.0, 'user_DisplayName': '高田航', 'user_Reputation': 131.0, 'user_Views': 10.0, 'user_id': 192416.0}}