With the ideal opamp, we cam assume:
- infinite gain
- infinite input impedance
- zero offset voltage
So, whatever we input to the positive (or negative) input is multiplied by infinite gain. If we leave the opamp open loop, the output will just hit one of the rails (positive or negative depending on the polarity of the input signal)
However, if we feed some of the output back to the inverting input, we can use this to control the gain (and negative feedback has some other useful effects also)
With your example and an ideal opamp, it doesn't matter what value the resistors are, or whether they are equal. Since there is no current flowing through either of them, the result is always the same (a gain of 1).
With a real opamp, you have an input bias current (we will ignore the myriad of other non-ideal parameters and just focus on this one), so matching the impedance both inputs see is a good idea (unless there is already internal compensation, which some opamps have - in some cases matching the impedances can make things worse due to the input bias currents being unequal)
So for the example in your question, say we have an input impedance of 1MΩ (a very low value, but some opamps can have very low input impedances, make sure to check the datasheet), we use 10kΩ for the input resistor, but no resistor in the feedback loop. We will choose an input voltage of 1V.
We now get an input current of 1V / 1MΩ = 1uA.
So we now have a voltage drop across the input resistor of 1uA * 10kΩ = 10mV, which is present at the output (which will be 990mV) instead of 1V
If we want to prevent this, we need to match the voltage drop in the feedback loop to cancel out the offset caused by the input bias currents. So we use 10kΩ for the feedback resistor, it drops 10mV too so output is now 1V again.
Here's an example of matching the parallel combination of the feedback resistors when you have some gain:
This app note from Analog Devices is worth a read for more in depth discussion.